<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.limesurvey.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tpartner</id>
	<title>LimeSurvey Manual - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.limesurvey.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tpartner"/>
	<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/Special:Contributions/Tpartner"/>
	<updated>2026-08-10T18:08:55Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=177977</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=177977"/>
		<updated>2023-07-13T14:23:17Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* LimeSurvey version 6.x */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 6.x==&lt;br /&gt;
&lt;br /&gt;
This is an updated script for version 6.x which also handles sub-question relevance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
			&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+] Add row&#039;;&lt;br /&gt;
			var removeContent = &#039;[-] Remove row&#039;;&lt;br /&gt;
			&lt;br /&gt;
			// The classes for the Add/Remove elements - modify as you wish&lt;br /&gt;
			// See https://getbootstrap.com/docs/5.0/getting-started/introduction/&lt;br /&gt;
			var addClasses = &#039;inserted-button add btn btn-success&#039;;&lt;br /&gt;
			var removeClasses = &#039;inserted-button remove btn btn-danger&#039;;&lt;br /&gt;
			&lt;br /&gt;
			// The styles for the Add/Remove elements - modify as you wish&lt;br /&gt;
			// These could be placed in your custom.css file.&lt;br /&gt;
			var addStyles = &#039;margin:10px 0 10px 10px; padding:1px 5px; text-align:center; width:auto; cursor:pointer; float:left;&#039;;&lt;br /&gt;
			var removeStyles = &#039;margin:10px 0 10px 10px; padding:1px 5px; text-align:center; width:auto; cursor:pointer; float:left;&#039;;&lt;br /&gt;
			&lt;br /&gt;
			// Insert the buttons&lt;br /&gt;
			$( &#039;table.ls-answers&#039;, thisQuestion).after(&#039;&amp;lt;div class=&amp;quot;button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
					&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;&#039;+addClasses+&#039;&amp;quot; style=&amp;quot;&#039;+addStyles+&#039;&amp;quot;&amp;gt;&#039;+addContent+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
					&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;&#039;+removeClasses+&#039;&amp;quot; style=&amp;quot;display: none; &#039;+removeStyles+&#039;&amp;quot;&amp;gt;&#039;+removeContent+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
				&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Listeners on the buttons&lt;br /&gt;
			$(&#039;.inserted-button.add&#039;, thisQuestion).on(&#039;click&#039;, function (event) {&lt;br /&gt;
				addRow();&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.inserted-button.remove&#039;, thisQuestion).on(&#039;click&#039;, function (event) {&lt;br /&gt;
				removeRow();&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Define the relevant rows&lt;br /&gt;
			var relevantRows = $(&#039;tr.subquestion-list:not(.ls-irrelevant)&#039;, thisQuestion);&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, show the &amp;quot;Remove&amp;quot; element and hide the &amp;quot;Add&amp;quot; element if all rows are shown&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$(&#039;[data-visible=&amp;quot;false&amp;quot;]:first&#039;, thisQuestion).attr(&#039;data-visible&#039;, &#039;true&#039;).show();&lt;br /&gt;
				$(&#039;.inserted-button.remove&#039;, thisQuestion).show();&lt;br /&gt;
				console.log($(&#039;[data-visible=&amp;quot;true&amp;quot;]&#039;, thisQuestion).length+&#039; == &#039;+$(relevantRows).length - 1);&lt;br /&gt;
				if ($(&#039;[data-visible=&amp;quot;false&amp;quot;]&#039;, thisQuestion).length == 0)  {&lt;br /&gt;
					$(&#039;.inserted-button.add&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
				$(&#039;.inserted-button.add&#039;, thisQuestion).blur();&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, clear the contents of the removed row,&lt;br /&gt;
			// show the &amp;quot;Add&amp;quot; element if the last row is hidden and hide the &amp;quot;Remove&amp;quot; element if only the first row is shown&lt;br /&gt;
			function removeRow() {&lt;br /&gt;
				$(&#039;[data-visible=&amp;quot;true&amp;quot;]:last input:text&#039;, thisQuestion).val(&#039;&#039;).trigger(&#039;keyup&#039;);&lt;br /&gt;
				$(&#039;[data-visible=&amp;quot;true&amp;quot;]:last&#039;, thisQuestion).attr(&#039;data-visible&#039;, &#039;false&#039;).hide();&lt;br /&gt;
				$(&#039;.inserted-button.add&#039;, thisQuestion).show();&lt;br /&gt;
				if ($(&#039;[data-visible=&amp;quot;true&amp;quot;]&#039;, thisQuestion).length == 0)  {&lt;br /&gt;
					$(&#039;.inserted-button.remove&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
				$(&#039;.inserted-button.remove&#039;, thisQuestion).blur();&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$(relevantRows).slice(1).each(function(i) {&lt;br /&gt;
				$( this ).attr(&#039;data-visible&#039;, &#039;false&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
				$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
					if ($.trim($(this).val()) != &#039;&#039;) {&lt;br /&gt;
						$(this).closest(&#039;tr&#039;).attr(&#039;data-visible&#039;, &#039;true&#039;).show();&lt;br /&gt;
						$(&#039;.inserted-button.remove&#039;, thisQuestion).show();&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace the ID question at the end of the function call.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the last answer option&lt;br /&gt;
			var ansCount = $( &#039;div#question&#039; + qID + &#039; select option&#039; ).length - 1;&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer option at the end of the list&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; )&lt;br /&gt;
				.appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the qID (replace the qID eg. partRandDD(244)) &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
		//If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
     });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&#039;&#039;Tested with: 3.08 - 3.15&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 4.x==&lt;br /&gt;
&#039;&#039;Tested with: 4.5.1&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:qSort-4.x.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LimeSurvey Version 3.x==&lt;br /&gt;
Here is a custom question theme for LS 3.x - https://github.com/tpartner/LimeSurvey-Social-Value-Orientation&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=177966</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=177966"/>
		<updated>2023-07-13T14:21:55Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Variable Length Array (Multi Flexible Text) question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 6.x==&lt;br /&gt;
&lt;br /&gt;
This is an updated script for version 6.x:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
			&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+] Add row&#039;;&lt;br /&gt;
			var removeContent = &#039;[-] Remove row&#039;;&lt;br /&gt;
			&lt;br /&gt;
			// The classes for the Add/Remove elements - modify as you wish&lt;br /&gt;
			// See https://getbootstrap.com/docs/5.0/getting-started/introduction/&lt;br /&gt;
			var addClasses = &#039;inserted-button add btn btn-success&#039;;&lt;br /&gt;
			var removeClasses = &#039;inserted-button remove btn btn-danger&#039;;&lt;br /&gt;
			&lt;br /&gt;
			// The styles for the Add/Remove elements - modify as you wish&lt;br /&gt;
			// These could be placed in your custom.css file.&lt;br /&gt;
			var addStyles = &#039;margin:10px 0 10px 10px; padding:1px 5px; text-align:center; width:auto; cursor:pointer; float:left;&#039;;&lt;br /&gt;
			var removeStyles = &#039;margin:10px 0 10px 10px; padding:1px 5px; text-align:center; width:auto; cursor:pointer; float:left;&#039;;&lt;br /&gt;
			&lt;br /&gt;
			// Insert the buttons&lt;br /&gt;
			$( &#039;table.ls-answers&#039;, thisQuestion).after(&#039;&amp;lt;div class=&amp;quot;button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
					&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;&#039;+addClasses+&#039;&amp;quot; style=&amp;quot;&#039;+addStyles+&#039;&amp;quot;&amp;gt;&#039;+addContent+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
					&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;&#039;+removeClasses+&#039;&amp;quot; style=&amp;quot;display: none; &#039;+removeStyles+&#039;&amp;quot;&amp;gt;&#039;+removeContent+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
				&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Listeners on the buttons&lt;br /&gt;
			$(&#039;.inserted-button.add&#039;, thisQuestion).on(&#039;click&#039;, function (event) {&lt;br /&gt;
				addRow();&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.inserted-button.remove&#039;, thisQuestion).on(&#039;click&#039;, function (event) {&lt;br /&gt;
				removeRow();&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Define the relevant rows&lt;br /&gt;
			var relevantRows = $(&#039;tr.subquestion-list:not(.ls-irrelevant)&#039;, thisQuestion);&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, show the &amp;quot;Remove&amp;quot; element and hide the &amp;quot;Add&amp;quot; element if all rows are shown&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$(&#039;[data-visible=&amp;quot;false&amp;quot;]:first&#039;, thisQuestion).attr(&#039;data-visible&#039;, &#039;true&#039;).show();&lt;br /&gt;
				$(&#039;.inserted-button.remove&#039;, thisQuestion).show();&lt;br /&gt;
				console.log($(&#039;[data-visible=&amp;quot;true&amp;quot;]&#039;, thisQuestion).length+&#039; == &#039;+$(relevantRows).length - 1);&lt;br /&gt;
				if ($(&#039;[data-visible=&amp;quot;false&amp;quot;]&#039;, thisQuestion).length == 0)  {&lt;br /&gt;
					$(&#039;.inserted-button.add&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
				$(&#039;.inserted-button.add&#039;, thisQuestion).blur();&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, clear the contents of the removed row,&lt;br /&gt;
			// show the &amp;quot;Add&amp;quot; element if the last row is hidden and hide the &amp;quot;Remove&amp;quot; element if only the first row is shown&lt;br /&gt;
			function removeRow() {&lt;br /&gt;
				$(&#039;[data-visible=&amp;quot;true&amp;quot;]:last input:text&#039;, thisQuestion).val(&#039;&#039;).trigger(&#039;keyup&#039;);&lt;br /&gt;
				$(&#039;[data-visible=&amp;quot;true&amp;quot;]:last&#039;, thisQuestion).attr(&#039;data-visible&#039;, &#039;false&#039;).hide();&lt;br /&gt;
				$(&#039;.inserted-button.add&#039;, thisQuestion).show();&lt;br /&gt;
				if ($(&#039;[data-visible=&amp;quot;true&amp;quot;]&#039;, thisQuestion).length == 0)  {&lt;br /&gt;
					$(&#039;.inserted-button.remove&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
				$(&#039;.inserted-button.remove&#039;, thisQuestion).blur();&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$(relevantRows).slice(1).each(function(i) {&lt;br /&gt;
				$( this ).attr(&#039;data-visible&#039;, &#039;false&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
				$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
					if ($.trim($(this).val()) != &#039;&#039;) {&lt;br /&gt;
						$(this).closest(&#039;tr&#039;).attr(&#039;data-visible&#039;, &#039;true&#039;).show();&lt;br /&gt;
						$(&#039;.inserted-button.remove&#039;, thisQuestion).show();&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace the ID question at the end of the function call.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the last answer option&lt;br /&gt;
			var ansCount = $( &#039;div#question&#039; + qID + &#039; select option&#039; ).length - 1;&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer option at the end of the list&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; )&lt;br /&gt;
				.appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the qID (replace the qID eg. partRandDD(244)) &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
		//If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
     });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&#039;&#039;Tested with: 3.08 - 3.15&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 4.x==&lt;br /&gt;
&#039;&#039;Tested with: 4.5.1&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:qSort-4.x.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LimeSurvey Version 3.x==&lt;br /&gt;
Here is a custom question theme for LS 3.x - https://github.com/tpartner/LimeSurvey-Social-Value-Orientation&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Survey_behaviour&amp;diff=176534</id>
		<title>Workarounds: Survey behaviour</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Survey_behaviour&amp;diff=176534"/>
		<updated>2023-05-11T17:31:34Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Random question sets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
LimeSurvey users have been very creative in finding out how to change the behavior of a survey. All their workarounds are listed here. You can find some &#039;&#039;&#039;similar approaches&#039;&#039;&#039; at:&lt;br /&gt;
* [[Workarounds: Manipulating a survey at runtime using Javascript]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Respond multiple times using the same computer=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
With this workaround it will be possible to respond multiple times to the same survey. Normally there will be a message saying that the computer already received the answers. To prevent this you have to add the following code to the URL that leads to the survey &#039;&#039;&amp;quot;&amp;amp;newtest;=Y&amp;quot;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example of the &amp;quot;new&amp;quot; url:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://www.yourdomain.org/limesurvey/index.php?sid=12345&amp;amp;newtest;=Y&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Allow Multiple Survey Invitations to the same Email Address to be completed in the Same Browser Session=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Problem:&#039;&#039;&#039; When Multiple Surveys Invitations are activated during the same browser session, the second and subsequent survey activation results in a system message stating that the survey has already been completed. A user would have to close the browser and reopen in order to complete the next survey inviation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Workaround:&#039;&#039;&#039; Edit the Survey Invitation Email (also the reminder) Template. Append &amp;quot;&amp;amp;newtest;=Y&amp;quot; to the {SURVEYURL} line so it looks like this {SURVEYURL}&amp;amp;newtest;=Y&lt;br /&gt;
&lt;br /&gt;
Save the edited templates.&lt;br /&gt;
&lt;br /&gt;
Note: The save of this template edit does not seem to work when using HTML invitations, only text based invitations.&lt;br /&gt;
&lt;br /&gt;
=Add a data field to manually add data=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add some additional data after a user has finished a survey you can use the dataentry screen of the admin panel. You have to set up the survey as follows:&lt;br /&gt;
# Create a question that can store the needed data at the end of the survey.&lt;br /&gt;
# Use [[Setting conditions|conditions]] on the previous question so that whatever is answered at the previous question the following question &#039;&#039;&#039;doesn&#039;t appear&#039;&#039;&#039;.&lt;br /&gt;
# To enter several questions repeat steps 1-2. Don&#039;t forget to adapt the conditions.&lt;br /&gt;
# Go to the admin panel, chose the survey from the list and go to &#039;&#039;Dataentry screen for survey&#039;&#039;.&lt;br /&gt;
# Enter the additional data&lt;br /&gt;
&lt;br /&gt;
=Randomization=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Alert|All these workarounds can be replaced using the[[Question_type_-_Short_free_text#Randomization_group_name_.28random_group.29|randomization group name attribute]] (located in the question settings) or [[Question_groups_-_introduction#Create_question_group||randomization group]] at group level.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Totally random survey order==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you want to use random order globally for all questions in your survey, you can do it like this, depending on what type of question routine you use.&lt;br /&gt;
# If you use Group by Group add &amp;quot;shuffle($_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;grouplist&#039;]);&amp;quot; at the end of UpdateSessionGroupList($language) function in index.php&lt;br /&gt;
# If you use Question by Question or All-in-one put &amp;quot;shuffle($_SESSION&amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;&#039;fieldarray&#039;])&amp;quot; at the end of buildsurveysession() function in index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; This modifications affect all surveys in application, you may want to use an if statement with surveyid to make this work with specific surveys e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if ($surveyid==12345)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  do_some_shuffling()&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Saving survey is not possible because this workaround doesn&#039;t save random order for specyfic tokens.&lt;br /&gt;
*Solution doesn&#039;t care about language changes so if you have on in your survey this will not work.&lt;br /&gt;
*Using conditions is not possible because conditions rely on a fixed and pre-determined order of questions.&lt;br /&gt;
&lt;br /&gt;
==Randomize the order of &#039;&#039;sequences of groups&#039;&#039; in a survey==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.86&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can randomize the order of subsequences of groups in a survey. E.g., you may have a survey comprising the below group structure&lt;br /&gt;
*demographics&lt;br /&gt;
*itemgroup1&lt;br /&gt;
*itemgroup2&lt;br /&gt;
*itemgroup3&lt;br /&gt;
*interlude&lt;br /&gt;
*itemgroup4&lt;br /&gt;
*itemgroup5&lt;br /&gt;
*itemgroup6&lt;br /&gt;
*closingcomments&lt;br /&gt;
&lt;br /&gt;
and want to separately randomize the presentation order of itemgroup1...3 and itemgroup4...6 while maintaining the position of the other three groups. A working code modification is described in the PDF file [http://bugs.limesurvey.org/file_download.php?file_id=1228&amp;amp;type;=bug randomize_groups] which is downloadable from the Bugtracker at [http://bugs.limesurvey.org/view.php?id=557].&lt;br /&gt;
* &#039;&#039;&#039;Note:&#039;&#039;&#039; The code will randomize the order of subsequent groups in isolation, not across different sequences. Hence in the above example, you might get &#039;&#039;itemgroup1, 3, 2&#039;&#039; but never &#039;&#039;itemgroup1, 4, 2&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Note:&#039;&#039;&#039; The survey presentation format must be &#039;&#039;Group by Group&#039;&#039; not &#039;&#039;Question by Question&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Note:&#039;&#039;&#039; If you wish to select only a limited number of groups from a larger set, replace&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$scratcharr = array_merge($scratcharr, $randarr);&amp;lt;/syntaxhighlight&amp;gt;with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$scratcharr = array_merge($scratcharr, array_slice($randarr,0,x));&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where x is the number of elements/groups that you wish to include. In the example above &#039;&#039;&#039;$scratcharr = array_merge($scratcharr, array_slice($randarr,0,2));&#039;&#039;&#039; would select two out of the possible three groups in each group set.&lt;br /&gt;
* &#039;&#039;&#039;Warning:&#039;&#039;&#039; The code is compatible with conditions operating on items within a group but most possibly produces erroneous behavior with conditions between groups&lt;br /&gt;
* &#039;&#039;&#039;Warning:&#039;&#039;&#039; In a multi-language survey, the groups get randomized each time the language is changed. A simple workaround is to remove the language changer from the question pages of the survey leaving it on the welcome page only. (Though not totally foolproof this does lower the risk of unnecessary language changes.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Randomly show X out of Y question groups==&lt;br /&gt;
This workaround allows you to randomly show X out of Y question groups&lt;br /&gt;
&lt;br /&gt;
Tested with: Version 2.06+ Build 150612 Default template&lt;br /&gt;
&lt;br /&gt;
Workaround created by user &amp;quot;OMdev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Create a multi question with y number of answer options. Randomize this question from question settings.&lt;br /&gt;
*Select top X number of check boxes by add the following script to the source of this question.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(function(){&lt;br /&gt;
$(&#039;body&#039;).hide() //Hiding multi select question using JavaScript . You can also hide it with CSS.&lt;br /&gt;
var showNumberOfGroups = 2; //enter number of check box to select from top ie number of groups to show randomly.&lt;br /&gt;
var $cboxs = $(&#039;input:checkbox&#039;);&lt;br /&gt;
	for(var i=0;i&amp;lt;showNumberOfGroups;i++){&lt;br /&gt;
		$cboxs.eq(i).prop(&#039;checked&#039;,true);&lt;br /&gt;
	}&lt;br /&gt;
document.getElementById(&#039;movenextbtn&#039;).click();//auto submitting page.&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add group relevance from the multi select question.&lt;br /&gt;
&lt;br /&gt;
*You can download lss from below link.&lt;br /&gt;
https://www.limesurvey.org/en/forum/can-i-do-this-with-limesurvey/102176-show-x-out-of-y-question-groups#126288&lt;br /&gt;
&lt;br /&gt;
==Selective Question Randomization==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.82&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
With this workaround you are able to select which groups within a survey should have their questions randomized and not kept in order. This workaround also adds a tab in the question ordering page. The extra tab allows you to enable / disable question randomization for the selected group.&lt;br /&gt;
&lt;br /&gt;
A working code and database modification is described in the PDF file [http://bugs.limesurvey.org/file_download.php?file_id=1939&amp;amp;type;=bug selective_random_questions] which is downloadable from the Bugtracker at [http://bugs.limesurvey.org/view.php?id=3107].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; This might not work when adding conditions or assessments to the survey.&lt;br /&gt;
&lt;br /&gt;
==Randomize the order of questions within individual groups - JavaScript solution==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomize the order of questions in individual groups. It uses JavaScript/jQuery to apply this randomization to only those groups that you wish and requires no modification of the core files when updating the installation.&lt;br /&gt;
&lt;br /&gt;
The script uses a cookie to &amp;quot;remember&amp;quot; the shuffled order of the questions for the duration of the session so if a respondent navigates away from the group and returns, they will see the same question order. However if the survey is submitted or the session expires the questions will be re-shuffled.&lt;br /&gt;
&lt;br /&gt;
A couple of cautions about the script are:&lt;br /&gt;
#If the survey is saved, the questions will be re-shuffled when it is accessed again (as with the PHP solution).&lt;br /&gt;
#The question shuffling may play havoc with conditions within a group (as with the PHP solution).&lt;br /&gt;
#The script has been tested with all templates shipped with 1.85+ but if you have a custom template with &amp;quot;question&amp;quot; in the ID of division(s) (ie &amp;lt;div id=&amp;quot;&amp;lt;span style=&#039;color:red&#039;&amp;gt;question&amp;lt;/span&amp;gt;Holder&amp;quot;&amp;gt;) it may fail - the script looks for all divs with IDs starting with &amp;quot;question&amp;quot; and adds them to an array to be shuffled.&lt;br /&gt;
&lt;br /&gt;
There is a small demonstration [http://www.partnersinc.biz/surveys//index.php?sid=84767&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Put simply, the script:&lt;br /&gt;
#Checks cookies to see if the questions have already been shuffled for this group and session.&lt;br /&gt;
#If so - displays the questions in that order.&lt;br /&gt;
#If not - creates an array of all of the questions in the group, shuffles the array, sets a cookie with the shuffled array contents, displays the questions in the shuffled order.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript (see [[Optional settings#Security|documentation here]])..&lt;br /&gt;
#Create your group and questions.&lt;br /&gt;
#In the source of the group description add the following onload function (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script]]).&lt;br /&gt;
&lt;br /&gt;
Onload code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       function shuffleQuestions() {&lt;br /&gt;
&lt;br /&gt;
           // Create an array to hold question IDs&lt;br /&gt;
&lt;br /&gt;
           var qArray = new Array();&lt;br /&gt;
&lt;br /&gt;
           // Find the group ID of the page&lt;br /&gt;
&lt;br /&gt;
           var fieldNames = $( &#039;input#fieldnames&#039; ).attr(&#039;value&#039;);&lt;br /&gt;
&lt;br /&gt;
           var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
&lt;br /&gt;
           var sID = tmp[0];&lt;br /&gt;
&lt;br /&gt;
           var gID = tmp[1];&lt;br /&gt;
&lt;br /&gt;
           // A function to get the value of a cookie by name&lt;br /&gt;
&lt;br /&gt;
           function getCookie ( cookieName ) {&lt;br /&gt;
&lt;br /&gt;
               var results = document.cookie.match ( &#039;(&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;|;) ?&#039; + cookieName + &#039;=([&amp;lt;/div&amp;gt;;]*)(;|$)&#039; );&lt;br /&gt;
&lt;br /&gt;
               if ( results ) {&lt;br /&gt;
&lt;br /&gt;
                   return ( unescape ( results[2] ) );&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return null;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Get the session name&lt;br /&gt;
&lt;br /&gt;
           var sessionName = getCookie ( &#039;PHPSESSID&#039; );&lt;br /&gt;
&lt;br /&gt;
           // Check to see if the question order has already been shuffled in this session&lt;br /&gt;
&lt;br /&gt;
           var cookieArray = getCookie ( &#039;sArray&#039; + gID + &#039;_&#039; + sessionName );&lt;br /&gt;
&lt;br /&gt;
           // If already shuffled, use that question order&lt;br /&gt;
&lt;br /&gt;
           if ( cookieArray ) {&lt;br /&gt;
&lt;br /&gt;
               //qArray = $.trim(cookieArray);&lt;br /&gt;
&lt;br /&gt;
               qArray = cookieArray.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // If not, go ahead and shuffle&lt;br /&gt;
&lt;br /&gt;
           else {&lt;br /&gt;
&lt;br /&gt;
               // Load the IDs of all questions on the page into the array&lt;br /&gt;
&lt;br /&gt;
               $( &#039;div[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;question&amp;quot;]&#039; ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
                   qArray.push($( this ).attr(&#039;id&#039;));&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
               // Shuffle the questions array&lt;br /&gt;
&lt;br /&gt;
               function shuffle(o){&lt;br /&gt;
&lt;br /&gt;
                   for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);&lt;br /&gt;
&lt;br /&gt;
                   return o;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               shuffle(qArray);&lt;br /&gt;
&lt;br /&gt;
               // Set a cookie with the value of the shuffled array&lt;br /&gt;
&lt;br /&gt;
               var today = new Date();&lt;br /&gt;
&lt;br /&gt;
               today.setTime( today.getTime() );&lt;br /&gt;
&lt;br /&gt;
               var expires = 2 * 1000 * 60 * 60 * 24; // Expire the cookie in 2 days&lt;br /&gt;
&lt;br /&gt;
               var expiresDate = new Date( today.getTime() + (expires) );&lt;br /&gt;
&lt;br /&gt;
               document.cookie = &#039;sArray&#039; + gID + &#039;_&#039; + sessionName + &#039;=&#039; + qArray + &#039;;expires=&#039; + expiresDate.toGMTString();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Wrap the questions in a div&lt;br /&gt;
&lt;br /&gt;
           $( &#039;div[id&amp;lt;/div&amp;gt;=&amp;quot;question&amp;quot;]&#039; ).wrapAll( document.createElement(&#039;div&#039;) );&lt;br /&gt;
&lt;br /&gt;
           $( &#039;div[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;question&amp;quot;]:eq(0)&#039; ).parent().attr(&#039;id&#039;, &#039;qWrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
           $( &#039;div#qWrapper&#039; ).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;padding&#039;:0,&lt;br /&gt;
&lt;br /&gt;
               &#039;margin&#039;:0&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the questions into the wrapper in the shuffled order&lt;br /&gt;
&lt;br /&gt;
           $.each(qArray, function(i, val){&lt;br /&gt;
&lt;br /&gt;
               $( &#039;div#&#039; + val + &#039;&#039; ).appendTo( $( &#039;#qWrapper&#039; ) );&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       shuffleQuestions();&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Randomise the order of questions &#039;&#039;within&#039;&#039; groups==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can randomize the order questions of within groups (i.e. without interleaving questions from different groups) like this:&lt;br /&gt;
&lt;br /&gt;
1 Call a custom function from the last line of buildsurveysession() before the return statement in index.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$_SESSION[&#039;fieldarray&#039;] = withinGroupsShuffle();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Add these custom functions at the end of the same file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$currentGid;&lt;br /&gt;
&lt;br /&gt;
function withinGroupsShuffle() {&lt;br /&gt;
&lt;br /&gt;
   global $currentGid;&lt;br /&gt;
&lt;br /&gt;
   $groupArray = array();&lt;br /&gt;
&lt;br /&gt;
   $shuffledArray = array();&lt;br /&gt;
&lt;br /&gt;
   foreach ($_SESSION[&#039;grouplist&#039;] as $group)    {&lt;br /&gt;
&lt;br /&gt;
       $currentGid = $group[0];&lt;br /&gt;
&lt;br /&gt;
       $groupArray = array_filter($_SESSION[&#039;fieldarray&#039;], &amp;quot;questionInGroup&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
       shuffle($groupArray);&lt;br /&gt;
&lt;br /&gt;
       $tmp = $shuffledArray;&lt;br /&gt;
&lt;br /&gt;
       $shuffledArray = array_merge($tmp, $groupArray);&lt;br /&gt;
&lt;br /&gt;
       $groupArray = array();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   return $shuffledArray;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function questionInGroup($question) {&lt;br /&gt;
&lt;br /&gt;
   global $currentGid;&lt;br /&gt;
&lt;br /&gt;
   return ($question[5] == $currentGid) ? 1 : 0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;I&#039;m new to PHP, so please make changes if you can make the code shorter or more elegant&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This could be combined with the method mentioned above for shuffling the order of groups:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
shuffle($_SESSION[&#039;grouplist&#039;]);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I don&#039;t know how this code affects or is affected by conditions or tokens! This code has the same limitations as the global randomisation above: it applies to all groups in all surveys. It would be nice to add a group-level parameter like randomise_questions = [0|1], but I can&#039;t find a mechanism for doing that.&lt;br /&gt;
&lt;br /&gt;
==Randomize all questions in &amp;quot;All In One&amp;quot; mode - even if they are place in groups.==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround will randomize all questions when using &amp;quot;All In One&amp;quot; mode, even if they are place in groups. This may be useful if you want to use group assessments and display all questions on a single page in a random order.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
*The workaround is tested in the default template and may need slight tweaks for others.&lt;br /&gt;
*It is NOT tested with conditions.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Add the following script to the source of one of the questions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       shuffleQuestions();&lt;br /&gt;
&lt;br /&gt;
       function shuffleQuestions() {&lt;br /&gt;
&lt;br /&gt;
           // Hide the group wrappers&lt;br /&gt;
&lt;br /&gt;
           $(&#039;div[id&amp;lt;/div&amp;gt;=&amp;quot;group-&amp;quot;]&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
           // Create and insert a new question wrapper&lt;br /&gt;
&lt;br /&gt;
           var qWrapper = &#039;&amp;lt;div id=&amp;quot;qWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
&lt;br /&gt;
                       &amp;lt;table class=&amp;quot;group&amp;quot;&amp;gt; \&lt;br /&gt;
&lt;br /&gt;
                           &amp;lt;tbody&amp;gt; \&lt;br /&gt;
&lt;br /&gt;
                               &amp;lt;tr&amp;gt; \&lt;br /&gt;
&lt;br /&gt;
                                   &amp;lt;td&amp;gt; \&lt;br /&gt;
&lt;br /&gt;
                                   &amp;lt;/td&amp;gt; \&lt;br /&gt;
&lt;br /&gt;
                               &amp;lt;/tr&amp;gt; \&lt;br /&gt;
&lt;br /&gt;
                           &amp;lt;/tbody&amp;gt; \&lt;br /&gt;
&lt;br /&gt;
                       &amp;lt;/table&amp;gt;\&lt;br /&gt;
&lt;br /&gt;
                   &amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
           $(&#039;div[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;group-&amp;quot;]:last&#039;).after(qWrapper);&lt;br /&gt;
&lt;br /&gt;
           $( &#039;div#qWrapper td&#039; ).css({&#039;padding-top&#039;:&#039;10px&#039;});&lt;br /&gt;
&lt;br /&gt;
           // Create an array to hold question IDs&lt;br /&gt;
&lt;br /&gt;
           var qArray = new Array();&lt;br /&gt;
&lt;br /&gt;
           // Load the IDs of all questions on the page into the array&lt;br /&gt;
&lt;br /&gt;
           $(&#039;div[id&amp;lt;/div&amp;gt;=&amp;quot;question&amp;quot;]&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
               qArray.push($(this).attr(&#039;id&#039;));&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Shuffle the questions array&lt;br /&gt;
&lt;br /&gt;
           function shuffle(o){&lt;br /&gt;
&lt;br /&gt;
               for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);&lt;br /&gt;
&lt;br /&gt;
               return o;&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           shuffle(qArray);&lt;br /&gt;
&lt;br /&gt;
           // Insert the questions into the new question wrapper in the shuffled order&lt;br /&gt;
&lt;br /&gt;
           $.each(qArray, function(i, val){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;div#&#039; + val + &#039;&#039;).appendTo($(&#039;#qWrapper td:first&#039;));&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Random question sets==&lt;br /&gt;
===Pre 2.0===&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, in conjunction with the [[Workarounds: Survey behaviour#Randomize the order of questions within individual groups - JavaScript solution|randomizing questions script]], allows you to display a random set of questions in a group.&lt;br /&gt;
&lt;br /&gt;
JavaScript is used to first shuffle the question order and then hide the number of questions that you stipulate, effectively giving respondents a random question set. So if you have 5 questions in your group and choose to hide 2, the respondents will be presented with a random 3 questions.&lt;br /&gt;
&lt;br /&gt;
A brief explanation of the script is:&lt;br /&gt;
*The questions are shuffled (see [[Workarounds: Survey behaviour#Randomize the order of questions within individual groups -  JavaScript solution|randomizing questions]]) and their IDs placed in an array.&lt;br /&gt;
*The number of questions to be shown is calculated and their IDs are moved to a new array.&lt;br /&gt;
*All questions in the first array are hidden - this effectively hides the first &#039;&#039;&#039;&#039;&#039;n&#039;&#039;&#039;&#039;&#039; questions on the page so you&#039;ll get a random set of questions displayed.&lt;br /&gt;
*An asterisk is prepended to the remaining questions (remove this if your questions are not mandatory).&lt;br /&gt;
*When the next/submit button is clicked, all remaining questions are checked for an answer. If any are unanswered, their text is turned red, an alert is popped up and the next/submit is aborted (remove this if your questions are not mandatory).&lt;br /&gt;
&lt;br /&gt;
A cookie is used to &amp;quot;remember&amp;quot; the shuffled order of the questions for the duration of the session so if a respondent navigates away from the group and returns, they will see the same question set. However if the survey is submitted or the session expires, the questions will be re-shuffled and a new set will be displayed. Therefor this workaround should not be used with surveys that can be saved.&lt;br /&gt;
&lt;br /&gt;
A couple of cautions about the script are:&lt;br /&gt;
#If the survey is saved, the questions will be re-shuffled when it is accessed again and a new question set will be displayed.&lt;br /&gt;
#The question shuffling may play havoc with conditions within a group.&lt;br /&gt;
#The script has been tested with all templates shipped with 1.85+ but if you have a custom template with &amp;quot;question&amp;quot; in the ID of division(s) (ie &amp;lt;div id=&amp;quot;&amp;lt;span style=&#039;color:red&#039;&amp;gt;question&amp;lt;/span&amp;gt;Holder&amp;quot;&amp;gt;) it may fail - the script looks for all divs with IDs starting with &amp;quot;question&amp;quot; and adds them to an array to be shuffled.&lt;br /&gt;
#The script may need to be modified to display the &amp;quot;Mandatory&amp;quot; asterisk in templates other than the default - see below.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create your group with all questions non-mandatory (we&#039;ll make them mandatory later with JavaScript).&lt;br /&gt;
#In the source of the group description add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the function call at the end of the script for the number of questions to be hidden and the mandatory error text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		function shuffleQuestions() {&lt;br /&gt;
			// Create an array to hold question IDs&lt;br /&gt;
			var qArray = new Array();&lt;br /&gt;
&lt;br /&gt;
			// Find the group ID of the page&lt;br /&gt;
			var fieldNames = $( &#039;input#fieldnames&#039; ).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
			var gID = tmp[1];&lt;br /&gt;
&lt;br /&gt;
			// A function to get the value of a cookie by name&lt;br /&gt;
			function getCookie ( cookieName ) {&lt;br /&gt;
				var results = document.cookie.match ( &#039;(&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;|;) ?&#039; + cookieName + &#039;=([&amp;lt;/div&amp;gt;;]*)(;|$)&#039; );&lt;br /&gt;
				if ( results ) {&lt;br /&gt;
					return ( unescape ( results[2] ) );&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return null;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Get the session name&lt;br /&gt;
			var sessionName = getCookie ( &#039;PHPSESSID&#039; );&lt;br /&gt;
			// Check to see if the question order has already been shuffled in this session&lt;br /&gt;
			var cookieArray = getCookie ( &#039;sArray&#039; + gID + &#039;_&#039; + sessionName );&lt;br /&gt;
			// If already shuffled, use that question order&lt;br /&gt;
			if ( cookieArray ) {&lt;br /&gt;
				//qArray = $.trim(cookieArray);&lt;br /&gt;
				qArray = cookieArray.split(&#039;,&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			// If not, go ahead and shuffle&lt;br /&gt;
			else {&lt;br /&gt;
				// Load the IDs of all questions on the page into the array&lt;br /&gt;
				$( &#039;div[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;question&amp;quot;]&#039; ).each(function(i) {&lt;br /&gt;
					qArray.push($( this ).attr(&#039;id&#039;));&lt;br /&gt;
				});&lt;br /&gt;
				// Shuffle the questions array&lt;br /&gt;
				function shuffle(o){&lt;br /&gt;
					for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);&lt;br /&gt;
					return o;&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				shuffle(qArray);&lt;br /&gt;
&lt;br /&gt;
				// Set a cookie with the value of the shuffled array&lt;br /&gt;
				var today = new Date();&lt;br /&gt;
				today.setTime( today.getTime() );&lt;br /&gt;
				var expires = 2 * 1000 * 60 * 60 * 24; // Expire the cookie in 2 days&lt;br /&gt;
				var expiresDate = new Date( today.getTime() + (expires) );&lt;br /&gt;
				document.cookie = &#039;sArray&#039; + gID + &#039;_&#039; + sessionName + &#039;=&#039; + qArray + &#039;;expires=&#039; + expiresDate.toGMTString();&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Wrap the questions in a div&lt;br /&gt;
			$( &#039;div[id&amp;lt;/div&amp;gt;=&amp;quot;question&amp;quot;]&#039; ).wrapAll( document.createElement(&#039;div&#039;) );&lt;br /&gt;
			$( &#039;div[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;question&amp;quot;]:eq(0)&#039; ).parent().attr(&#039;id&#039;, &#039;qWrapper&#039;);&lt;br /&gt;
			$( &#039;div#qWrapper&#039; ).css({&lt;br /&gt;
				&#039;padding&#039;:0,&lt;br /&gt;
				&#039;margin&#039;:0&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Insert the questions into the wrapper in the shuffled order&lt;br /&gt;
			$.each(qArray, function(i, val){&lt;br /&gt;
				$( &#039;div#&#039; + val + &#039;&#039; ).appendTo( $( &#039;#qWrapper&#039; ) );&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		shuffleQuestions();&lt;br /&gt;
&lt;br /&gt;
		function hideQuestions(numberToHide, mandatoryMsg) {&lt;br /&gt;
			// Create an array of the IDs of all questions on the page&lt;br /&gt;
			var questions = new Array();&lt;br /&gt;
			$( &#039;div[id&amp;lt;/div&amp;gt;=&amp;quot;question&amp;quot;]&#039; ).each(function(i) {&lt;br /&gt;
				questions.push($( this ).attr(&#039;id&#039;));&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Remove the &amp;quot;shown&amp;quot; questions and place them in a new array&lt;br /&gt;
			var questionsLength = questions.length;&lt;br /&gt;
			var shownQuestions = questions.splice(numberToHide,questionsLength-numberToHide);&lt;br /&gt;
&lt;br /&gt;
			// Hide the remaining questions&lt;br /&gt;
			$.each(questions, function(i, val){&lt;br /&gt;
				$( &#039;div#&#039; + val + &#039;&#039; ).hide();&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add an asterisk to the &amp;quot;shown&amp;quot; questions&lt;br /&gt;
			// NOTE: Comment this section out if questions are not mandatory&lt;br /&gt;
			$( &#039;td.questiontext&#039; ).prepend( &#039;&amp;lt;span class=&amp;quot;asterisk&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Interrupt the submit function and validate mandatory questions&lt;br /&gt;
			// NOTE: Comment this section out if questions are not mandatory&lt;br /&gt;
			$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
				// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
				$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Loop through all &amp;quot;shown&amp;quot; questions and check for answer&lt;br /&gt;
				var answered = 0;&lt;br /&gt;
				$.each(shownQuestions, function(i, val){&lt;br /&gt;
					if ( $( &#039;div#&#039; + val + &#039; input.radio:checked&#039; ).length == 0 ) {&lt;br /&gt;
						$( &#039;div#&#039; + val + &#039;&#039; ).css(&#039;color&#039;, &#039;red&#039;);&lt;br /&gt;
						answered = 1;&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$( &#039;div#&#039; + val + &#039;&#039; ).css(&#039;color&#039;, &#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
&lt;br /&gt;
				if ( answered == 1 ) {&lt;br /&gt;
					alert ( mandatoryMsg );&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the hide function&lt;br /&gt;
		// Edit here for number of question to hide and mandatory message&lt;br /&gt;
		hideQuestions(2, &#039;Please complete all questions&#039;);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add the asterisk to non default templates, replace &#039;&#039;$( &#039;td.questiontext&#039; ).prepend( &#039;&amp;lt;span class=&amp;quot;asterisk&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&#039;);&#039;&#039;&#039;&#039; with:&lt;br /&gt;
&lt;br /&gt;
- basic - &#039;&#039;$( &#039;td.be&#039; ).prepend( &#039;&amp;lt;span class=&amp;quot;asterisk&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&#039;);&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
- bluengrey - Not possible to insert asterisk in correct location&lt;br /&gt;
&lt;br /&gt;
- business_grey - &#039;&#039;$( &#039;div.questiontext&#039; ).prepend( &#039;&amp;lt;span class=&amp;quot;asterisk&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&#039;);&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
- clear_logo - &#039;&#039;$( &#039;td.be&#039; ).prepend( &#039;&amp;lt;span class=&amp;quot;asterisk&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&#039;);&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
- default - &#039;&#039;$( &#039;td.questiontext&#039; ).prepend( &#039;&amp;lt;span class=&amp;quot;asterisk&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&#039;);&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
- eirenicon - Not possible to insert asterisk in correct location&lt;br /&gt;
&lt;br /&gt;
- limespired - &#039;&#039;$( &#039;div.survey-question-text&#039; ).prepend( &#039;&amp;lt;span class=&amp;quot;asterisk&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&#039;);&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
- mint_idea - &#039;&#039;$( &#039;div.survey-question-text&#039; ).prepend( &#039;&amp;lt;span class=&amp;quot;asterisk&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&#039;);&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
- sherpa - &#039;&#039;$( &#039;div.survey-question-text&#039; ).prepend( &#039;&amp;lt;span class=&amp;quot;asterisk&amp;quot;&amp;gt;*&amp;lt;/span&amp;gt;&#039;);&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
- vallendar - Not possible to insert asterisk in correct location&lt;br /&gt;
&lt;br /&gt;
===Version 2.0 And Newer===&lt;br /&gt;
Here is a link to a sample survey showing how to do this with Relevance - [[ExpressionScript sample surveys#Randomly Ask A Specific Number Of Questions In A Group (a subset of the questions)|Randomly Ask A Specific Number Of Questions In A Group (a subset of the questions)]]&lt;br /&gt;
&lt;br /&gt;
==Randomization - &#039;&#039;Assign People Randomly&#039;&#039; To Surveys==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a very easy way to assign people randomly to surveys, I think experts do it in other ways, but it works for me.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;LINK.PHP:&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php &lt;br /&gt;
  $db = @file(&amp;quot;link.txt&amp;quot;); // path to .txt file &lt;br /&gt;
  $anz = @count($db); &lt;br /&gt;
  srand((double)microtime()*1000000); // random numbers &lt;br /&gt;
  $random = rand(1,$anz); &lt;br /&gt;
  print $db[$random-1]; &lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;LINK.TXT:&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;1;url=http://www.survey1.com&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;meta http-equiv=&amp;quot;refresh&amp;quot; content=&amp;quot;1;url=http://www.survey2.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;Only one link per line!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;INDEX.PHP:&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&amp;lt;title&amp;gt;title&amp;lt;/title&amp;gt; &lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;?php &lt;br /&gt;
  include(&amp;quot;link.php&amp;quot;); &lt;br /&gt;
  ?&amp;gt; &lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/head&amp;gt; &lt;br /&gt;
  &amp;lt;body&amp;gt; &lt;br /&gt;
  &amp;lt;!-- shows the loading statement --&amp;gt; &lt;br /&gt;
  &amp;lt;table width=100% height=100%&amp;gt;  &lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td valign=middle&amp;gt;&lt;br /&gt;
  &amp;lt;center&amp;gt;&amp;lt;font size=5&amp;gt;loading ... &amp;lt;/font&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
  &amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;/table&amp;gt; &lt;br /&gt;
  &amp;lt;!-- shows the loading statement --&amp;gt; &lt;br /&gt;
  &amp;lt;/body&amp;gt; &lt;br /&gt;
  &amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Random Redirect responders to surveys==&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As the workaround above, this one assign randomly (uniform distribution) people to multiple surveys in easier way, but with the same outcome: every survey has the same probability to be accessed by a responder.&lt;br /&gt;
&lt;br /&gt;
1. Copy and paste the code below in a text editor. &lt;br /&gt;
2. Replace the URLs with those of your surveys, and save it as index.php &lt;br /&gt;
3. Create a new directory in your server.&lt;br /&gt;
4. Upload the file in that directory and give the link (http://www.yourdomain.com/newdirectory) to the responders.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
$urls = array(&amp;quot;www.site1.com&amp;quot;, &lt;br /&gt;
              &amp;quot;www.site2.com&amp;quot;, &lt;br /&gt;
              &amp;quot;www.site3.com&amp;quot;); &lt;br /&gt;
$url = $urls[array_rand($urls)]; &lt;br /&gt;
header(&amp;quot;Location: http://$url&amp;quot;); &lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Prefilling survey elements=&lt;br /&gt;
&lt;br /&gt;
There are some ways to pre-fill elements in a survey. The data to prefill an answer can be passed by URL if it matches a certain format.&lt;br /&gt;
&lt;br /&gt;
==Prefilling survey answers using the survey URL==&lt;br /&gt;
&#039;&#039;Tested with: 1.80 and later&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can prefill answers to questions in your survey by passing the [[SGQA identifier]], and the answer, as a parameter of your survey URL. This feature will only work where the survey is commenced immediately upon entering the URL (so it won&#039;t work if you use CAPTCHA&#039;s to restrict access, or the registration page).&lt;br /&gt;
&lt;br /&gt;
You&#039;ll need to ensure that the answer you pass is the correct format for the question you are attempting to prefill - for example - multiple option questions should contain a &amp;quot;Y&amp;quot; to check a box. List type questions need the correct answer code. To be certain which codes to pass, complete a survey manually with the prefilled answer(s) you want, and then export the results as question codes and answer codes(not full text). This will give you both the correct SGQA identifier (the name of the column), and the correct format for the answer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting with version 1.92+, you can use [[ExpressionScript#Access to Variables|qcode naming]] for the variables in addition to, or instead of, using SGQA naming.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;In &#039;&#039;&#039;version 2.x&#039;&#039;&#039; the link for a prefill have to look like that:  http://www.example.com/index.php/survey/index/sid/712544/newtest/Y?712544X99X2151=gelb&amp;amp;712544X99X2152=12345 &amp;lt;br&amp;gt; And if your question code is QCODE and CODE2, you can use it like that : http://www.example.com/index.php/survey/index/sid/712544/newtest/Y?QCODE=gelb&amp;amp;CODE2=12345 &lt;br /&gt;
It&#039;s important to add &amp;quot;newtest/Y&amp;quot; to the link.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;http://www.example.../index.php?sid=1234&amp;amp;1234X43X123=Y&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With 2.0, if your url is like this /survey/sid/1234, you have to use:&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;http://www.example.../survey/sid/1234/1234X43X123/Y&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the user gets to that question, the &amp;quot;Y&amp;quot; will be prefilled as the answer to question 123 in group 43 in survey 1234.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example Single-Choice:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;http://www.example.../index.php?sid=1234&amp;amp;1234X43X123=A2&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With 2.0, if your url is like this /survey/sid/1234, you have to use:&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;http://www.example.../survey/sid/1234/1234X43X123/A2&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you like to prefill a single choice question (answer-code A1 - X ), you have to write this. If you export the results of this question, you will see, that this kind of question save the answer code as result in table. Use in any case the capital &amp;quot;X&amp;quot; in the link!&lt;br /&gt;
&lt;br /&gt;
===Prefilling survey answers using the survey URL and hiding the Answer===&lt;br /&gt;
&lt;br /&gt;
Starting with version 1.87 every question has a property &#039;Always hide this question&#039; which can be used for this purpose.&lt;br /&gt;
&lt;br /&gt;
==Prefilling a date question with the current date==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.80RC3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Workaround created by user &amp;quot;Mazi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Using the [[Workarounds: Survey behaviour#Prefilling survey answers using the survey URL|workaround mentioned above]] you can prefill the current date for a date question. Instead of using the common link to a survey which looks like this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;http://www.yourdomain.org/limesurvey/index.php?sid=53298&amp;amp;newtest;=Y&amp;amp;lang;=de&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you create an additional script, let&#039;s call it date.php. This script contains the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
   $date = date(&amp;quot;Y-m-d&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   header(&amp;quot;Location: http://www.yourdomain.org/limesurvey/index.php?sid=53298&amp;amp;newtest;=Y&amp;amp;lang;=de&amp;amp;53298X15X102=$date&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script determines the current date and calls the survey with a certain URL. The current date is attached as the answer for a certain date question using [http://docs.limesurvey.org/tiki-index.php?page=SGQA+identifier SGQA identifier]. Don&#039;t forget to &#039;&#039;&#039;adjust the SID and SGQA identifier&#039;&#039;&#039; according to your survey/group/question ID!&lt;br /&gt;
&lt;br /&gt;
Upload the new &#039;&#039;date.php&#039;&#039; file into your limesurvey directory. You can then call the survey using this link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;http://www.yourdomain.org/limesurvey/date.php&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Things to watch out for:&lt;br /&gt;
* Date questions always use the internal date data format of the database which has to be YYYY-MM-DD!&lt;br /&gt;
* You have to adjust the SID at the URl.&lt;br /&gt;
* Also adjust the SGQA identifier (SIDXGIDXQID) according to your survey.&lt;br /&gt;
* This solution doesn&#039;t work if you use tokens at your survey.&lt;br /&gt;
&lt;br /&gt;
=Offer option to change answers later=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When having a closed access survey using a token table it is possible to offer the opportunity to change answers later. Normally after having submitted the answers a token is marked as &amp;quot;used&amp;quot;. To prevent this do as follows:&lt;br /&gt;
* set your survey to question-by-question mode (or group-by-group mode)&lt;br /&gt;
* set the survey to Non anonymous + Allow persistence for token answers&lt;br /&gt;
* activate survey and create your token table&lt;br /&gt;
* add at least one question of type boilerplate (which contains just some text). This is necessaray to give some instructions to the user like &amp;quot;&#039;&#039;Your answers have been recorded to the DB, if you&#039;re sure you won&#039;t modify them, you can submit your response. If unsure, please quit your browser now and get back later with the private URL you&#039;ve received&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
By not submitting the survey the user is still able to change the answers later.&lt;br /&gt;
&lt;br /&gt;
=Use general password for accessing a survey=&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to use tokens but a general password to access a survey you can set your survey to &amp;quot;allow public access&amp;quot;. Don&#039;t create a token table but use the following workaround:&lt;br /&gt;
# Create a short text question first&lt;br /&gt;
# Create the other questions&lt;br /&gt;
# Use conditions on all the other questions. You can use regular expressions to validate the string entered at the short text question. Just validate a certain password. If the password is correct the following questions are shown.&lt;br /&gt;
# Create a boilerplate question which just says &amp;quot;invalid password&amp;quot; which is shown if the user entered a wrong password.&lt;br /&gt;
&lt;br /&gt;
=Create token on the fly and Edit completed survey=&lt;br /&gt;
&lt;br /&gt;
Warning: The link for the code link is wrong (June 2013)&lt;br /&gt;
&lt;br /&gt;
When having a close token survey you can create a token on the fly by giving as parameters sid and token.&lt;br /&gt;
&lt;br /&gt;
In addition if someone has already completed a survey he can review his answers and correct them.&lt;br /&gt;
&lt;br /&gt;
[http://bugs.limesurvey.org/view.php?id=2982 Just put this script attached at the bugtracker ticket into limesurveys root directory]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites&#039;&#039;&#039;:&lt;br /&gt;
# Anonymous answers? No (This survey is NOT anonymous.)&lt;br /&gt;
# Enable Token-based answers persistence? Yes&lt;br /&gt;
# Switch to closed-acces mode&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;http://www.example.com/limesurvey180/newtoken.php?sid=98761&amp;amp;token;=12345&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where Survey id = 98761 your survey&#039;s id and token=12345 a token (any token actually)&lt;br /&gt;
# The first time the token will be created and you you will redirect to anwser the surrvey&lt;br /&gt;
# If you wont complete the survey and call the script with the same parameters you will be redirect to the same case in order to finish the survey&lt;br /&gt;
# If you finish the survey and call the script with the same parameters you will see restart the survey with your previews answers prefiled so you can change them&lt;br /&gt;
# Back to 3&lt;br /&gt;
&lt;br /&gt;
this is valid for all survey in the installation but you can make a filter so it wont be valid for every survey.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reference&#039;&#039;&#039;&lt;br /&gt;
*You can find the code provided by user &amp;quot;janokary&amp;quot; and a short explanation at the LimeSurvey Bug &amp;amp; Feature Tracker: [http://bugs.limesurvey.org/view.php?id=2982]&lt;br /&gt;
&lt;br /&gt;
=multiple &#039;completed&#039; with only one token=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.71&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Whit a closed survey, each token work only one time. Sometime we need the possibility to complete a particular survey several time with the same token. This works only if you survey is set to non-anonymous answers and to use datestamps.&lt;br /&gt;
&lt;br /&gt;
Here is an example for the survey id &#039;71314&#039;.  Don&#039;t forget to adapt your own sid.&lt;br /&gt;
&lt;br /&gt;
Edit &#039;&#039;index.php &#039;&#039; to in the function submittokens() replace lines ~ 1312 :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (bIsTokenCompletedDatestamped($thissurvey))&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
   $utquery .= &amp;quot;SET completed=&#039;$today&#039;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
   $utquery .= &amp;quot;SET completed=&#039;Y&#039;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;with lines :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (bIsTokenCompletedDatestamped($thissurvey))&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
   //multiple token only for survey 71314&lt;br /&gt;
&lt;br /&gt;
   if ($surveyid == &#039;71314&#039;) {&lt;br /&gt;
&lt;br /&gt;
   $utquery .= &amp;quot;SET completed=&#039;N&#039;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   }else {&lt;br /&gt;
&lt;br /&gt;
   $utquery .= &amp;quot;SET completed=&#039;$today&#039;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
   //$utquery .= &amp;quot;SET completed=&#039;Y&#039;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We never update the database with the completed date and time for this survey.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039; : a limitation of this code is that you never recieve a confirmation mail for the completed.&lt;br /&gt;
&lt;br /&gt;
=Loop question(s)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is no real loop option within LimeSurvey 1.x. To loop a question an initial question to determine the number of loops is needed. Looping is then done using a condition workaround:&lt;br /&gt;
&lt;br /&gt;
1. Create a single choice question asking &amp;quot;How many X do you want to rate&amp;quot;, possible answers 1, 2, 3, 4, 5.&lt;br /&gt;
&lt;br /&gt;
2. Create up to 5 following questions asking &amp;quot;Please rate item 1/2/3/...&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3. Check manual -&amp;gt; conditions and read it carefully.&lt;br /&gt;
&lt;br /&gt;
4. Set conditions like&lt;br /&gt;
&lt;br /&gt;
a) &amp;quot;Only show Q3 (Rate item 2) IF Q1 (How many...) was answered 2&lt;br /&gt;
&lt;br /&gt;
OR Q1 (How many...) was answered 3&lt;br /&gt;
&lt;br /&gt;
OR Q1 (How many...) was answered 4&lt;br /&gt;
&lt;br /&gt;
OR Q1 (How many...) was answered 5&amp;quot;&lt;br /&gt;
&lt;br /&gt;
b) &amp;quot;Only show Q4 (Rate item 3) IF Q1 (How many...) was answered 3&lt;br /&gt;
&lt;br /&gt;
OR Q1 (How many...) was answered 4&lt;br /&gt;
&lt;br /&gt;
OR Q1 (How many...) was answered 5&amp;quot;&lt;br /&gt;
&lt;br /&gt;
c) Q5... see above&lt;br /&gt;
&lt;br /&gt;
d) Q6...&lt;br /&gt;
&lt;br /&gt;
Of course Q2 is always shown, the following question will be added by conditions depending on what the user answered at Q1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent accidentially closing the survey=&lt;br /&gt;
&lt;br /&gt;
Sometimes you want to ask the user to confirm that they want to close an incomplete survey and/or use the back/reload buttons (which might break LimeSurvey).&lt;br /&gt;
&lt;br /&gt;
A solution can be done in javascript, as discussed in the forum: https://www.limesurvey.org/en/community-services/forums/can-i-do-this-with-limesurvey/96384-prevent-accidentially-closing-the-survey&lt;br /&gt;
&lt;br /&gt;
You can add this functionality in the template.js file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//FEATURES: (2015-03-27) Now with fix for iframes (e.g. file uploader) and the template editor &lt;br /&gt;
function goodbye(e) {&lt;br /&gt;
    if(!$(&#039;body&#039;, top.document).hasClass(&#039;submitted&#039;) &amp;amp;&amp;amp; !$(&#039;#completed&#039;).length &amp;amp;&amp;amp; !$(&#039;.templateeditor&#039;, top.document).length) { //check if a button was used to navigate OR the survey is completed OR the template is displayed in the template editor&lt;br /&gt;
&lt;br /&gt;
		if(!e) e = window.event;&lt;br /&gt;
		//e.cancelBubble is supported by IE - this will kill the bubbling process.&lt;br /&gt;
		e.cancelBubble = true;&lt;br /&gt;
		e.returnValue = &#039;Are you sure you want to quit this survey?&#039;; //This is displayed on the dialog for IE&lt;br /&gt;
 &lt;br /&gt;
		//e.stopPropagation works in Firefox.&lt;br /&gt;
		if (e.stopPropagation) {&lt;br /&gt;
			e.stopPropagation();&lt;br /&gt;
			e.preventDefault();&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		return &#039;Are you sure you want to quit this survey?&#039;; // For chrome&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
window.onbeforeunload = goodbye;&lt;br /&gt;
&lt;br /&gt;
$(document).on(&#039;click&#039;, &#039;.button, .changelang, [name=&amp;quot;move&amp;quot;]&#039;, function(event){ //added .changelang here, please add other classes if you know which should be allowed to navigate&lt;br /&gt;
	$(&#039;body&#039;, top.document).addClass(&#039;submitted&#039;);&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate system for Ranking=&lt;br /&gt;
&lt;br /&gt;
Sometimes default ranking are not usable for your survey. But Expression manager unique function can easily be used for other question type.&lt;br /&gt;
&lt;br /&gt;
* With an &#039;Array&#039; question where answer are number from 1 to X (X is the max number of choice to rank). &lt;br /&gt;
** &#039;Question validation equation&#039;: &amp;lt;code&amp;gt;unique(self)&amp;lt;/code&amp;gt;&lt;br /&gt;
* With a &#039;Multiple numerical input&#039; question :  &lt;br /&gt;
** &#039;Question validation equation&#039;: &amp;lt;code&amp;gt;unique(self) and count(self)==max(self) &amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;Sub-question validation equation&#039;: &amp;lt;code&amp;gt;(is_empty(NUMBER_SQ001) or is_int(NUMBER_SQ001)) and (is_empty(NUMBER_SQ002) or is_int(NUMBER_SQ002)) ...&amp;lt;/code&amp;gt; to have only integer value set&lt;br /&gt;
* With a &#039;Array (Numbers) &#039; question :&lt;br /&gt;
** &#039;Question validation equation&#039;: &amp;lt;code&amp;gt;unique(self) and count(self)==max(self) &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Demonstration can be found here : [http://limesurvey.sondages.pro/714997.html Demonstration of alternate ranking solution] , lss file : [[media:Limesurvey_survey_lotofranking.lss]]&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176533</id>
		<title>Workarounds: Question design, layout and templating</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176533"/>
		<updated>2023-05-11T17:30:38Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Star Rating System Using List (Radio) Question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This section more or less deals with styling your survey, adjusting the layout and setting up special question types. You can find &#039;&#039;&#039;similar information&#039;&#039;&#039; at these pages:&lt;br /&gt;
* [[The template editor]]&lt;br /&gt;
* [[Workarounds: Manipulating a survey at runtime using Javascript]]&lt;br /&gt;
* [[Workarounds: Survey behaviour]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves. &amp;lt;span style=&#039;color:#EE0000&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Different progress indicator=&lt;br /&gt;
&lt;br /&gt;
==Version 1.87 and later:==&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will find the progress value and insert it into the element following the progress bar.&lt;br /&gt;
&lt;br /&gt;
It should be pointed out that I had to introduce a delay in firing the function because the progress value is not calculated until after template.js is called. The delay is set at 1/10 of a second but you may be able to reduce that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // Display progress value&lt;br /&gt;
&lt;br /&gt;
   function setProgValue() {&lt;br /&gt;
&lt;br /&gt;
       var progress = $(&#039;#progressbar&#039;).attr(&#039;aria-valuenow&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).text(progress+&#039;%&#039;).show();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
       setTimeout(&#039;setProgValue()&#039;,100);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to hide the &amp;quot;0%&amp;quot; before the progress bar, add the following to the end of template.css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
#progress-pre {&lt;br /&gt;
&lt;br /&gt;
   display: none;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Delete unwanted gaps in question title=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When copying data (questions, answers, ...) from MS Word or other applications into the editor there might occur some gaps in the question title.&lt;br /&gt;
&lt;br /&gt;
There are two solutions to this:&lt;br /&gt;
# Use popup mode and manually delete unwanting extra html tags (requires html knowledge).&lt;br /&gt;
# Disable paste word feature: Tweak your limesurvey-config.js file in limesurvey/admin/scripts/fckeditor.26 and set the following option to true:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;FCKConfig.ForcePasteAsPlainText = true ;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that clear you browser cache and try again.&lt;br /&gt;
&lt;br /&gt;
=How to change the &amp;lt;font-size&amp;gt; tags using CSS=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This workaround was deleted because it is outdated. Such changes can be done by [[The template editor#Styling questions with CSS|adjusting template.css]] of your template.&lt;br /&gt;
&lt;br /&gt;
=Question type variation: Scale with bars (one and two sided)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some methodogical issues to think about: Very often a common scale as 1 to 5 or -2 to +2 fits all needs, as the shown subject is clearly defined as positive or negative. As soon as you would reduce the influence from the question and scale on the respondent, you will need something neutral to determine tendences, emphases and so on.&lt;br /&gt;
&lt;br /&gt;
So I put up a new variation of the one and two sided array question:&lt;br /&gt;
&lt;br /&gt;
ttp://www.limesurvey.org/images/fbfiles/images/example_bar_scale.jpg&lt;br /&gt;
&lt;br /&gt;
In my example the left side reads &amp;quot;strategical planning&amp;quot; and the right side &amp;quot;operative business&amp;quot;. None of these are purely negative or positive, so the bars only show in which direction the balancing point moves.&lt;br /&gt;
&lt;br /&gt;
To realize a question as shown above just do as follows:&lt;br /&gt;
&lt;br /&gt;
Set up as many bars as you will need (in my example there are four different bars in total) with a graphic program like PAINT .NET, GIMP or similar ones (yes, you may also use commercial software like Photoshop). To prevent the bars from looking twitchy, designate the size in advance. I did one bar 60x15 px, one 45x15px, one 30x15px and at last 15x15px. Save them as PNG, JPG or GIF.&lt;br /&gt;
# Create a new label set within Lime. Call it whatever you like.&lt;br /&gt;
# Enter a code number at first, then press the pencil symbol to enter the editor.&lt;br /&gt;
#Press the &amp;quot;Insert / edit image&amp;quot; button and upload the bar you want to insert with the FCK upload tool. Then choose the uploaded picture, save and leave the FCK editor.&lt;br /&gt;
#The row in the lable editor now shows an &amp;lt;img&amp;gt;-tag which refers to your bar picture.&lt;br /&gt;
#Repeat the above described steps as often as needed to build up your bar scale.&lt;br /&gt;
&lt;br /&gt;
=Doing a Likert Scale=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A Likert Scale is a special type of the Semantic Differential question where several item shall be rated on different scales, each marked at the beginning and at the end with opposite statements. &lt;br /&gt;
&lt;br /&gt;
To do this in LimeSurvey just follow these steps:&lt;br /&gt;
#Create a label set with values from 0 to 7 (for the classic Likert Scale - feel free to choose other ranges).&lt;br /&gt;
#Create a new question and choose Array (Flexible Labels) as question type.&lt;br /&gt;
#Assign the Likert Scale label set to this question.&lt;br /&gt;
#Enter your answers as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;DIV style=&amp;quot;white-space: nowrap;&amp;quot;&amp;gt;ITEM statement1|statement2&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The white-space style is to avoid line breaks which would ruin the whole scale. feel free to insert non-breakable spaces between the ITEM and statement1 to define the margin between these to strings.&lt;br /&gt;
&lt;br /&gt;
=Alternate background colour of questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To alternate the background colour of questions, open the &#039;&#039;template.css&#039;&#039; of your template with the Template Editor or a text editor and modify the &#039;&#039;Question styles&#039;&#039; section to include the following style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
div#question2 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question4 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question6 td.questiontext {&lt;br /&gt;
&lt;br /&gt;
   background-color: #E0EBF8;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to apply the style to all of the questions you would like modified using their question IDs (&#039;&#039;question2, question4, question6&#039;&#039; in this case). Question IDs are displayed when creating or editing questions - see below:&lt;br /&gt;
&lt;br /&gt;
[[File:qid_1_493x173.gif]]&lt;br /&gt;
&lt;br /&gt;
Here the question ID is #question80 .&lt;br /&gt;
&lt;br /&gt;
=Embedding audio in questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191), IE 7, FireFox 3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Audio clips can be embedded in most question text or answer text. In this example, using the default template, I&#039;ve embedded clips into the answers of an &#039;&#039;&#039;&#039;&#039;Array (Yes/No/Uncertain)&#039;&#039;&#039;&#039;&#039; question to ask respondents how they feel about some sounds. The resulting question will look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x202.gif]]&lt;br /&gt;
&lt;br /&gt;
It&#039;s accomplished by placing the following code in each of the answers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;embed height=&amp;quot;20&amp;quot; width=&amp;quot;128&amp;quot; autostart=&amp;quot;false&amp;quot; controls=&amp;quot;console&amp;quot;&lt;br /&gt;
&lt;br /&gt;
loop=&amp;quot;true&amp;quot; volume=&amp;quot;50&amp;quot; src=&amp;quot;{TEMPLATEURL}audio_1.mp3&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some notes about the code:&lt;br /&gt;
*The &#039;&#039;audio_1.mp3&#039;&#039; part will be different for each answer (it&#039;s the audio file name).&lt;br /&gt;
*In this case the audio files are residing in the template folder being used for this survey (that&#039;s where &#039;&#039;{TEMPLATEURL}&#039;&#039; points to) but they can be placed anywhere if you use an absolute URL in the &#039;&#039;src&#039;&#039; parameter - something like &#039;&#039;src=&amp;quot;http://mysite.com/audio/audio_1.mp3&amp;quot;&#039;&#039;&lt;br /&gt;
*If the audio file doesn&#039;t exist where the &#039;&#039;src&#039;&#039; parameter indicates, the player will not appear.&lt;br /&gt;
*You&#039;ll need to insert the code into the answers using the source screen - click on &amp;quot;Edit answers&amp;quot;, click the pencil beside the text box, click &amp;quot;Source&amp;quot; in the pop-up, enter the code and save it with the little diskette icon.&lt;br /&gt;
*You may need to turn off the XSS filter - see the documentation for [http://docs.limesurvey.org/tiki-index.php?page=Global+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Security Global settings].&lt;br /&gt;
&lt;br /&gt;
Although the above example places the audio in the answer text of the question, the same principles can be used to place it in the question text itself. Something like this perhaps.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x154.gif]]&lt;br /&gt;
&lt;br /&gt;
=Hiding inputs of a &amp;quot;Multiple options with comments&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
There may be times when you want to hide some of the input boxes of a &#039;&#039;&#039;&#039;&#039;Multiple choice question type with comments&#039;&#039;&#039;&#039;&#039; question as in the image below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:hidden_inputs_541x168.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This can be accomplished with CSS (see [[The template editor#Styling questions with CSS|Styling questions in LimeSurvey 1.8]]). For each input that you want to hide, add the following style to your template.css file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
#answer11111X22X33Acomment {&lt;br /&gt;
   display: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where 11111 is your survey ID, 22 is your group ID, 33 is your question ID and A is the answer code.&lt;br /&gt;
&lt;br /&gt;
Note that you will still see columns for the hidden inputs in your data but they will be empty.&lt;br /&gt;
&lt;br /&gt;
=Multiple question types in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90 - 1.92+, IE 7/8/9, Firefox 13, Safari 5, Chrome 10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Media:limesurvey_survey_62584.lss|Download the sample survey]]&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present multiple question types in what appears to be an array - as depicted in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=62584&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here] (download the sample survey - [[Media:limesurvey_survey_62584.lss|limesurvey_survey_62584.lss]]). This example uses the default template but should be adaptable to any template using divisions for question containers.&lt;br /&gt;
&lt;br /&gt;
[[File:inline_questions_700x228.png]]&lt;br /&gt;
&lt;br /&gt;
Basically what we do is take groups of questions (5 in this case), wrap them in a division and make them line up nicely horizontally and vertically. The width of the survey is also fixed to prevent wrapping issues. We do this with a JavaScript/jQuery function that inserts the necessary wrappers and then modifies styles so everything behaves properly. The top row is 5 boilerplate questions with the &amp;quot;column headers&amp;quot; as question text (the first just has a blank space). The following rows are a boilerplate with the &amp;quot;row headers&amp;quot; followed by 4 assorted questions.&lt;br /&gt;
&lt;br /&gt;
It should be noted that using conditions on these questions may result in unexpected behavior. If a question is hidden by conditions, the question(s) to the right of it will move over to take its place.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Create your questions keeping in mind how they will lay out when grouped into rows (in this example - boilerplate, yes/no, short text, numeric, dropdown, and repeat).&lt;br /&gt;
#In the source of the first boilerplate question add the function below (see [http://manual.limesurvey.org/wiki/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F How to use script]).&lt;br /&gt;
#Modify the number of rows, number of columns and the start placement in the function call (line 6) as required (the example uses 4 rows and 5 columns and the &amp;quot;array&amp;quot; starts with the third question on the page).&lt;br /&gt;
&lt;br /&gt;
The code may look intimidating at first but it&#039;s actually fairly simple. I&#039;ve laid it out as sequentially as possible and purposely used few shortcuts and many comments to make it easier to follow.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
*If you use question types other than boilerplate, short text, list dropdown, numeric or yes-no, you&#039;ll need to add to the last section of code, where it hides the question text and formats the inputs for display this way.&lt;br /&gt;
*Any extra questions on the page should follow this grid of questions, not precede them.&lt;br /&gt;
* If you use boilerplate as question type you should add after:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
the following 2 lines&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
//repair boilerplate questioncells&lt;br /&gt;
$(&#039;div.boilerplate td.questiontext&#039;).parent().show();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Javascript code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the &amp;quot;sideBySide&amp;quot; function with number of rows, columns and start position&lt;br /&gt;
		sideBySide(4, 5, 3);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function sideBySide(rows, columns, startQuestion) {&lt;br /&gt;
&lt;br /&gt;
		/*********** Display multiple questions side by side ***********/&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;div.qRow1&#039;).length == 0) {&lt;br /&gt;
&lt;br /&gt;
			var rowNum = 0;&lt;br /&gt;
			var colNum = 1;&lt;br /&gt;
			var rowList = new Array();&lt;br /&gt;
&lt;br /&gt;
			//////// Add question classes for later use ////////&lt;br /&gt;
&lt;br /&gt;
			// Loop through all questions and add row and column specific classes&lt;br /&gt;
			$(&#039;div[id^=&amp;quot;question&amp;quot;]&#039;).each(function(i) {&lt;br /&gt;
				if(i &amp;gt;= (startQuestion-1) &amp;amp;&amp;amp; rowNum &amp;lt; rows) { // This IF condition only needed if there are questions before or following the &amp;quot;inline&amp;quot; questions&lt;br /&gt;
					$(this).addClass(&#039;qRow&#039;+rowNum+&#039;&#039;).addClass(&#039;qCol&#039;+colNum+&#039;&#039;).addClass(&#039;inlineQuestion&#039;);&lt;br /&gt;
					if(rowNum == 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;columnLabel&#039;);&lt;br /&gt;
					}  &lt;br /&gt;
					if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum == 1) {&lt;br /&gt;
						$(this).addClass(&#039;rowLabel&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;questionCell&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					if(colNum == columns) {&lt;br /&gt;
						rowList.push(&#039;qRow&#039;+rowNum+&#039;&#039;);&lt;br /&gt;
						rowNum++;&lt;br /&gt;
						colNum = 1;&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						colNum++;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).addClass(&#039;normalQuestion&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Survey layout manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Fix the width of the survey&lt;br /&gt;
			$(&#039;table.outerframe&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;900px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Wrap each &amp;quot;row&amp;quot; in a wrapper div&lt;br /&gt;
			$(rowList).each(function(i) {&lt;br /&gt;
				$(&#039;.&#039;+this+&#039;&#039;).wrapAll(&#039;&amp;lt;div id=&amp;quot;inlineWrapper&#039;+i+&#039;&amp;quot; class=&amp;quot;inlineRow&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Style the wrapper divs&lt;br /&gt;
			$(&#039;.inlineRow&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;850px&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0 auto 0 auto&#039;,&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.inlineRow:first&#039; ).css({&lt;br /&gt;
				&#039;margin-top&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get all the questions to sit politely side by side&lt;br /&gt;
			$( &#039;.inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;float&#039;: &#039;left&#039;,&lt;br /&gt;
				&#039;height&#039;:&#039;41px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;-8px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;.inlineQuestion .questionhelp&#039; ).hide();&lt;br /&gt;
			$( &#039;.inlineQuestion .survey-question-help&#039; ).parent().hide();&lt;br /&gt;
		   &lt;br /&gt;
			// A little space under the last row&lt;br /&gt;
			$( &#039;.inlineRow:last .inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Any questions not displayed inline (this is only needed if there are questions following the &amp;quot;inline&amp;quot; questions)&lt;br /&gt;
			$( &#039;.normalQuestion&#039; ).css({&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Column manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Set the column widths - can be set individually if necessary&lt;br /&gt;
			// Must add up to less than 100%&lt;br /&gt;
			$( &#039;.qCol1&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;12%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.qCol2, .qCol3, .qCol4, .qCol5&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;22%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Question manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Hide the answer element in boilerplate questions&lt;br /&gt;
			$( &#039;div.boilerplate td.answer&#039; ).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
			$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Push the question tables to 100%&lt;br /&gt;
			$( &#039;div.inlineRow table&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;100%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get everything to line up nicely vertically&lt;br /&gt;
			$( &#039;.inlineQuestion td.questiontext, .inlineQuestion td.answer p&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Adjust cell heights so everything lines up nicely horizontally&lt;br /&gt;
			$( &#039;.inlineQuestion td.answer, .inlineQuestion td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;35px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;0.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;#inlineWrapper0 .inlineQuestion&#039; ).css({ &#039;height&#039;:&#039;50px&#039; });&lt;br /&gt;
			$( &#039;#inlineWrapper0 td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;50px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Yes-no question styles&lt;br /&gt;
			$( &#039;div.yes-no ul&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;,&lt;br /&gt;
				&#039;font-size&#039;: &#039;90%&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0&#039;,&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;5px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no li&#039; ).css({&lt;br /&gt;
				&#039;padding-right&#039;: &#039;1.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no td.answer&#039; ).css({&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Short-text question styles&lt;br /&gt;
			$( &#039;div.text-short input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Numeric question styles&lt;br /&gt;
			$( &#039;div.numeric input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.numeric p.tip&#039; ).css({&lt;br /&gt;
				&#039;display&#039;: &#039;none&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get rid of the margins around select boxes&lt;br /&gt;
			$( &#039;p.question&#039; ).css({ &#039;margin&#039;:&#039;0&#039; });&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Star Rating System=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://www.fyneworks.com/jquery/star-rating/ jQuery Star Rating Plugin] to display a series of stars that are used to generate a rating value. This value is then passed to either a hidden numeric input question or a hidden list radio question. Both methods are outlined below - use one or both depending on whether you want to use [Assessments|assessments].&lt;br /&gt;
&lt;br /&gt;
The plugin uses a series of radio inputs to generate the stars (more about these below). It allows the use of whole or partial stars as shown in the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x324.png]]&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using Numeric Input Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like your rating data to be collected as a numeric value and don&#039;t want to use [[Assessments|LimeSurvey assessments]] - it&#039;s a little easier to implement.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#[http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
##jquery.MetaData.js&lt;br /&gt;
##jquery.rating.css&lt;br /&gt;
##jquery.rating.js&lt;br /&gt;
##delete.gif&lt;br /&gt;
##star.gif&lt;br /&gt;
#In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a numeric input question and then in the source of the question add as many radio inputs as star segments. For example, if you would like 5 stars, each with half-segments, you would need 10 radio inputs and that would give rating values from 1-10.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q1 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;6&amp;quot; value=&amp;quot;6&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;7&amp;quot; value=&amp;quot;7&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;8&amp;quot; value=&amp;quot;8&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;9&amp;quot; value=&amp;quot;9&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;10&amp;quot; value=&amp;quot;10&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. A note on split stars. The stars in the above example are split in half by the &#039;&#039;{ split:2 }&#039;&#039; metadata. So if you don&#039;t want split stars, your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
7. Finally, in the source of the question add the following function after your inputs. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the numeric input and pass the rating values into it as they are changed. If the rating is canceled the numeric input is nullified. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingNumeric(11111, 22, 1); handleRatingNumeric(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingNumeric (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the numeric input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val();&lt;br /&gt;
&lt;br /&gt;
   if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the numeric question&lt;br /&gt;
&lt;br /&gt;
handleRatingNumeric (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using List (Radio) Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like to use [[Assessments|assessments]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
&lt;br /&gt;
2. Set up the template to use custom onload functions. (See the [[Workarounds: Manipulating a survey at runtime using Javascript#Custom onload function|workaround here]])&lt;br /&gt;
&lt;br /&gt;
3. [http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
*jquery.MetaData.js&lt;br /&gt;
*jquery.rating.css&lt;br /&gt;
*jquery.rating.js&lt;br /&gt;
*delete.gif&lt;br /&gt;
*star.gif&lt;br /&gt;
&lt;br /&gt;
4. In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a list (radio) question with the same amount of sequentially numbered answers as star ratings. For example, if you want 5 whole-stars, you would create 5 answers, as in the image below, and this would give you ratings from 1-5. Note that the &amp;quot;Codes&amp;quot; and &amp;quot;Answers&amp;quot; must be sequential numbers.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x156_v2.png]]&lt;br /&gt;
&lt;br /&gt;
6. In the list (radio) question, set the [[Advanced question settings|hide_tip]] question attribute to 1&lt;br /&gt;
&lt;br /&gt;
7. In the source of the question add as many radio inputs as star segments. So 5 whole-stars, would need 5 radio inputs.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q2 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. A note on split stars. The stars in the above example are whole-stars. If you want them split you need to add metadata to the class - something like &#039;&#039;{ split:2 }&#039;&#039;. So if you want half-stars your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
9. Finally, in the source of the question add the following function after your inputs. (See [http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure;=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ How to use script here])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the question radio buttons and toggle them as the rating values are changed. If the rating is canceled all question inputs are unchecked. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingRadio(11111, 22, 1); handleRatingRadio(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Onload code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingRadio (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the radio input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#question&#039; + qID + &#039; input.radio[checked=true]&#039;).attr(&#039;value&#039;);&lt;br /&gt;
&lt;br /&gt;
   //if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
   if ( rating ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio[value=&#039; + rating + &#039;]&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the radio question&lt;br /&gt;
&lt;br /&gt;
handleRatingRadio (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable column widths in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define all column widths of an array question - as shown in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here]. This example uses the default template shipped with 7557 but should be adaptable to any template.&lt;br /&gt;
&lt;br /&gt;
[[File:array_widths_701x226.gif]]&lt;br /&gt;
&lt;br /&gt;
We use a function to remove all of the widths imposed by the core code and then insert our own.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects documentation here]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Replace all instances of QQ with the question ID.&lt;br /&gt;
#In the third section of code, adjust the widths and add/remove columns as necessary. This example is for an array with a question text column followed by 3 answer columns as shown above.&lt;br /&gt;
#In the final section adjust the question text alignment to your liking&lt;br /&gt;
&lt;br /&gt;
Onload code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // Get rid of all the widths that the API imposes&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question col&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question thead td&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define a width for the question table so we can do so for its children&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Keep this to 95% or less so IE will behave&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question&#039; ).attr(&#039;width&#039;, &#039;95%&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define the column widths&lt;br /&gt;
&lt;br /&gt;
   // Add or remove columns and adjust widths as necessary but widths should add up to 100%&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Columns must be sequentially numbered starting at 0 - eg, td:eq(0), td:eq(1), td:eq(2).....&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th:eq(0)&#039; ).css({ &#039;width&#039;:&#039;10%&#039; }); // Answer text column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(0)&#039; ).css({ &#039;width&#039;:&#039;50%&#039; }); // First answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(1)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Second answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(2)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Third answer column&lt;br /&gt;
&lt;br /&gt;
   // Push the text input widths to 95% of their parent containers&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question input[type=&amp;quot;text&amp;quot;]&#039; ).css({ &#039;width&#039;:&#039;95%&#039; });&lt;br /&gt;
&lt;br /&gt;
   // Align the answer text - feel free to experiment&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th&#039; ).css({&#039;text-align&#039;:&#039;center&#039;});&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use images for radio buttons and checkboxes=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.92/2.0, using IE 9, FireFox 13, Chrome 16, Safari 5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses an adaptation of the jQuery imagetick.js plugin to replace the default radio buttons and checkboxes with images as pictured below:&lt;br /&gt;
&lt;br /&gt;
[[File:images.png]] &lt;br /&gt;
&lt;br /&gt;
This adaptation will work in the following question types:&lt;br /&gt;
*Array&lt;br /&gt;
*Array by column&lt;br /&gt;
*Array dual scale&lt;br /&gt;
*Array (5 point choice)&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
*Array (Increase-Same-Decrease)&lt;br /&gt;
*Array (Yes-No-Uncertain)&lt;br /&gt;
*Gender&lt;br /&gt;
*Yes-No&lt;br /&gt;
*Multiple choice&lt;br /&gt;
*Multiple choice with comments&lt;br /&gt;
*5 point choice&lt;br /&gt;
*List (Radio)&lt;br /&gt;
*List with comment&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey 2.0 and later implementation==&lt;br /&gt;
&lt;br /&gt;
Follow the instructions above with these changes:&lt;br /&gt;
#Download [[Media:Imagetick_lime_v2.1.zip|this modified version of the plugin for 2.0 and up]] instead of the one mentioned above and add all contained files to your template directory.&lt;br /&gt;
#Add these lines to the &amp;lt;head&amp;gt; element in your startpage.pstpl instead of the one above:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}imagetick_lime_2.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}imagetick_lime_2.css&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thanks to Jordan Boesch for the original plugin.&lt;br /&gt;
&lt;br /&gt;
=Changing the position and layout of an individual question using &amp;quot;question code&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (6536)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use this very flexible workaround you first have to apply a minor change to the question.pstpl of the used template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
needs to be changed to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this change won&#039;t change anything in the layout and can be left in the template even if you don&#039;t need this workaround. It&#039;s just a means to have a handle to actually change individual questions.&lt;br /&gt;
&lt;br /&gt;
You can then use a code such as the following in the question text to make question specific format changes. &amp;quot;SAMPLE&amp;quot; needs to be replaced with the concerning question code and javascript has to be allowed ([[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|older versions of limesurvey]], under global settings for newer versions).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.borderTop= &amp;quot;0px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginTop= &amp;quot;-62px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginLeft= &amp;quot;30px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sample code will hide the border at the top of the question, will move the whole question up by 62px and to the right by 30px. Using this workaround you can change a whole a lot of things concerning format and positions of a specific question without changing all the questions. A (German) list of all the allowed options can be found [http://de.selfhtml.org/javascript/objekte/style.htm#style_eigenschaften here].&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
==Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Assign a label set to the question - these will be the labels in the center column.&lt;br /&gt;
#Set the second parameter of the function call to true for randomized rows.&lt;br /&gt;
#Adjust the styles in lines 21-24 as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The script moves the question columns into the MaxDiff configuration and disables the opposing radio element when a selection is made.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
	&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, false);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function maxDiff(qID, randomize) {&lt;br /&gt;
		&lt;br /&gt;
		// Random number between 1 and 2&lt;br /&gt;
		// Math.floor(Math.random() * (max - min + 1)) + min;&lt;br /&gt;
		var randomNum = Math.floor(Math.random() * ((2-1)+1) + 1);&lt;br /&gt;
&lt;br /&gt;
		// Move the columns&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col:eq(1)&#039;).prependTo(&#039;colgroup.col-responses&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list thead tr:eq(0) th:eq(0)&#039;).prependTo(&#039;#question&#039;+qID+&#039; table.question thead tr:eq(0)&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Random rows&lt;br /&gt;
		if(randomize) {&lt;br /&gt;
			var rowsArr = [];&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
				$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
				rowsArr.push(i);&lt;br /&gt;
			});&lt;br /&gt;
			shuffleArray(rowsArr);&lt;br /&gt;
			$(rowsArr).each(function(i){&lt;br /&gt;
				$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody&#039;).append($(&#039;#question&#039;+qID+&#039; tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Style stuff&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col.odd&#039;).css({ &#039;background-color&#039;:&#039;transparent&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody th&#039;).css({ &#039;text-align&#039;:&#039;center&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:even td, #question&#039;+qID+&#039; table.question tbody tr:even th&#039;).css({ &#039;background-color&#039;:&#039;#F1F1F1&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:odd td, #question&#039;+qID+&#039; table.question tbody tr:odd th&#039;).css({ &#039;background-color&#039;:&#039;#FCFCFC&#039; });&lt;br /&gt;
&lt;br /&gt;
		// Prevent clicking twice in the same row&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input.radio&#039;).on(&#039;click&#039;, function () {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio&#039;).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio:checked&#039;).each(function(i) {&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				$(&#039;input.radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function shuffleArray(array) {&lt;br /&gt;
		for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
			var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
			var temp = array[i];&lt;br /&gt;
			array[i] = array[j];&lt;br /&gt;
			array[j] = temp;&lt;br /&gt;
		}&lt;br /&gt;
		return array;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Versions 2.5 and 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:MaxDiff_2.5.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Template.zip|Demo template]]&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Survey.zip|Demo survey]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Add 2 subquestions to the array - these will be the left and right columns.&lt;br /&gt;
#Add answers to the array - these will be the rows.&lt;br /&gt;
#Create a copy the default template.&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.js&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function maxDiff(qID, randomize) {&lt;br /&gt;
 &lt;br /&gt;
	// Identify some elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisTable = $(&#039;table.subquestion-list:eq(0)&#039;, thisQuestion);&lt;br /&gt;
 &lt;br /&gt;
	// Assign a new question class&lt;br /&gt;
	$(thisQuestion).addClass(&#039;max-diff-array&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Move the columns&lt;br /&gt;
	$(&#039;thead tr:eq(0)&#039;, thisTable).prepend($(&#039;thead tr:eq(0) th:eq(1)&#039;, thisTable));&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
		$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Random rows&lt;br /&gt;
	if(randomize) {&lt;br /&gt;
		var rowsArr = [];&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
			$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
			rowsArr.push(i);&lt;br /&gt;
		});&lt;br /&gt;
		shuffleArray(rowsArr);&lt;br /&gt;
		$(rowsArr).each(function(i){&lt;br /&gt;
			$(&#039;tbody&#039;, thisTable).append($(&#039;tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;, thisTable));&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	// Prevent clicking twice in the same row&lt;br /&gt;
	$(&#039;input:radio&#039;, thisQuestion).on(&#039;click&#039;, function () {&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;input:radio&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		$(&#039;input:radio:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr.answers-list&#039;);&lt;br /&gt;
			$(&#039;input:radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		});&lt;br /&gt;
	});	&lt;br /&gt;
 &lt;br /&gt;
	// Fix up the row classes&lt;br /&gt;
	var rowClass = 1;&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i) {&lt;br /&gt;
		$(this).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.css&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.max-diff-array th.answertext { &lt;br /&gt;
	text-align: center;&lt;br /&gt;
	border-right: 3px solid #FFFFFF;&lt;br /&gt;
	border-left: 3px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
/* Override the responsive &amp;quot;no-more-tables&amp;quot; stuff */&lt;br /&gt;
@media only screen and (max-width: 801px) {&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables table {&lt;br /&gt;
		display: table;&lt;br /&gt;
		border-collapse: inherit;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables thead, &lt;br /&gt;
	.max-diff-array .no-more-tables tbody {&lt;br /&gt;
		display: table-row-group;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables tr {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		position: relative;&lt;br /&gt;
		top: auto;&lt;br /&gt;
		display: table-row;&lt;br /&gt;
		border: 0 none;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables th, &lt;br /&gt;
	.max-diff-array .no-more-tables td {&lt;br /&gt;
		display: table-cell;&lt;br /&gt;
		text-align: center !important;&lt;br /&gt;
		color: #2c3e50;&lt;br /&gt;
		font-size: 15px;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array th.answertext { &lt;br /&gt;
		border-right: 3px solid #FFFFFF;&lt;br /&gt;
		border-left: 3px solid #FFFFFF;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .answer-item label span {&lt;br /&gt;
		display: none !important;&lt;br /&gt;
	}	&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add a script like this to the question source of the Array (flexible labels) question:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	   &lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, true);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Load SVG Code From Drawing Tool=&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to load a drawing tool and store the results in a huge-text question. The details are outlined in the [[Workarounds: Manipulating a survey at runtime using Javascript#Load SVG Code From Drawing Tool|JavaScript section of the workarounds]].&lt;br /&gt;
&lt;br /&gt;
=Minimum or Maximum Date in Datepicker=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note: From version 2.05 beta6, you MUST set the minimum and maximum date for the date picker directly in the advanced question attributes of the date/time question. This workaround will seize to work.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can set the minimum or maximum selectible date in a datepicker as follows&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]] and add the following to the source of the date question text or help. Replace &amp;quot;QQ&amp;quot; with the date question ID.&lt;br /&gt;
&lt;br /&gt;
For a minimum date of April 15, 2010:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date(2010, 4-1, 15) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a minimum date of the current date (today):&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date() );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a maximum date of May 10, 2015:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date(2015, 5-1, 10) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More details here - http://jqueryui.com/demos/datepicker/#option-minDate&lt;br /&gt;
&lt;br /&gt;
=Evaluative Space Grid (ESG)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 &amp;amp; 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The evaluative space grid (ESG) is a two-dimensional grid that provides a single-item measure of positivity and negativity (Larsen et al, 2009). See [http://leeds-faculty.colorado.edu/mcgrawp/pdf/larsen.norris.mcgraw.hawkley.cacioppo.2009.pdf page 4 of this PDF].&lt;br /&gt;
&lt;br /&gt;
This can be accomplished using a multiple-numeric question, some simple HTML and a little JavaScript.&lt;br /&gt;
&lt;br /&gt;
A table can be shown in the question. When a respondent clicks a grid cell in the table JavaScript loads the coordinates of the cell into the multiple-numeric question inputs.&lt;br /&gt;
&lt;br /&gt;
[[File:Space_grid_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create a Multiple Numeric question with two subquestions labelled &amp;quot;X&amp;quot; and &amp;quot;Y&amp;quot;.&lt;br /&gt;
#Add the following HTML to the source of the question to create the table:&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;spaceGrid&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td rowspan=&amp;quot;5&amp;quot; class=&amp;quot;yAxisLabel&amp;quot;&amp;gt;How NEGATIVE&amp;lt;br&amp;gt;&lt;br /&gt;
			do you feel about&amp;lt;br&amp;gt;&lt;br /&gt;
		the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td colspan=&amp;quot;5&amp;quot; class=&amp;quot;xAxisLabel&amp;quot;&amp;gt;How POSITIVE do you feel about the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following styles to the end of your template.css file:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.spaceGrid {&lt;br /&gt;
	width: auto;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.spaceGrid td {&lt;br /&gt;
	padding: 0 3px;&lt;br /&gt;
	text-align: center !important;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xAxisLabel {&lt;br /&gt;
	padding-top: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yAxisLabel {&lt;br /&gt;
	padding-right: 10px;&lt;br /&gt;
	width: 125px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xLabel {&lt;br /&gt;
	height: 20px;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yLabel {&lt;br /&gt;
	text-align: right !important;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.gridCell {&lt;br /&gt;
	width: 70px;&lt;br /&gt;
	height: 70px;&lt;br /&gt;
	border: 1px solid #666666;&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.checkedCell {&lt;br /&gt;
	background-color: #66FF00;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of your template.js file:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;	&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
	$(&#039;.spaceGrid&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
		// Define some vars&lt;br /&gt;
		var thisQuestion = $(this).closest(&#039;.numeric-multi&#039;);&lt;br /&gt;
		var thisTable = $(this).closest(&#039;table.spaceGrid&#039;);&lt;br /&gt;
		var numGridCell = $(&#039;.gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numCols = $(&#039;tr:eq(0) .gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numRows = numGridCell/numCols;&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers list&lt;br /&gt;
		$(&#039;.subquestion-list, .questions-list&#039;, thisQuestion).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Initial state&lt;br /&gt;
		var xCoord = $(&#039;input.text:eq(0)&#039;, thisQuestion).val() - 1;&lt;br /&gt;
		var yCoord = numRows - $(&#039;input.text:eq(1)&#039;, thisQuestion).val();&lt;br /&gt;
		$(&#039;tr:eq(&#039;+yCoord+&#039;) .gridCell:eq(&#039;+xCoord+&#039;)&#039;, thisTable).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the grid cells&lt;br /&gt;
		$(&#039;.gridCell&#039;).click(function(){&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Add class to checked cell&lt;br /&gt;
			$(&#039;.checkedCell&#039;, thisQuestion).removeClass(&#039;checkedCell&#039;);&lt;br /&gt;
			$(this).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Find the cell coordinates&lt;br /&gt;
			var reverseRowIndex = (numRows - $(&#039;tr&#039;, thisTable).index($(thisRow)));&lt;br /&gt;
			var colIndex = $(&#039;.gridCell&#039;, thisRow).index($(this)) + 1;&lt;br /&gt;
	&lt;br /&gt;
			// Load coordinates into inputs&lt;br /&gt;
			$(&#039;input.text:eq(0)&#039;, thisQuestion).val(colIndex);&lt;br /&gt;
			$(&#039;input.text:eq(1)&#039;, thisQuestion).val(reverseRowIndex);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The script should automatically handle different grid sizes.&lt;br /&gt;
&lt;br /&gt;
=Slider Highlighting=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may want to highlight a slider after it has been moved/changed to allow respondents to easily see which slider subquestions have been answered.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture.PNG]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;template.js&#039;&#039;&#039;:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&#039;html&#039;).bind(&#039;slidecreate&#039;, function(event, ui) {&lt;br /&gt;
	$(&#039;.slider_callout&#039;).each(function(i){&lt;br /&gt;
		if($(this).text().length &amp;gt; 0) {&lt;br /&gt;
			$(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	$(&#039;.ui-slider-horizontal&#039;).bind(&#039;slidechange&#039;, function(event, ui) {&lt;br /&gt;
	 $(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and would need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.numeric-multi .answer li {&lt;br /&gt;
	border-bottom: 5px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li label {&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li div.multinum-slider {&lt;br /&gt;
	margin: 1.5em 0.5em 0.2em 0;&lt;br /&gt;
	padding-left: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ui-slider-1 {&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.changedSlider {&lt;br /&gt;
	background-color: #99FFFF;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Dynamic Slider Call-Out Styles=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 9-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is an example of how to insert a custom &#039;&#039;&#039;&#039;&#039;slide()&#039;&#039;&#039;&#039;&#039; function to control the appearance of the slider call-out as the slider is manipulated. In this example the call-out text colour changes as the slider is moved. Sample survey here - [[Media:Dynamic_slider_call_out.lss|dynamic call-out slider survey]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Dynamic_slider_call_out.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
 &lt;br /&gt;
		// Slide function&lt;br /&gt;
		$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function( event, ui ) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), ui.value);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Initial callout states&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), $(this).val());&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Handle the callout style&lt;br /&gt;
		function handleCallout(thisRow, sliderVal) {&lt;br /&gt;
			if(sliderVal &amp;lt; 20) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D90000&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 40) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D96D00&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 60) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D9D900&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#00B22D&#039;);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sliders in Array-Numbers or Array-Dual-Scale-Numbers=&lt;br /&gt;
&lt;br /&gt;
This workaround will replace the dropdowns in &#039;&#039;&#039;&#039;&#039;array-numbers&#039;&#039;&#039;&#039;&#039; or &#039;&#039;&#039;&#039;&#039;array-dual-scale-numbers&#039;&#039;&#039;&#039;&#039; questions with sliders. The sliders will automatically have the same minimum, maximum and steps that you set in the advanced question settings.&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.06==&lt;br /&gt;
[[File:custom_sliders_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; select&#039;).each(function(i, el){&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				var id = $(el).attr(&#039;id&#039;).replace(/#/g,&#039;-&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = Number($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).val());&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).next(&#039;option&#039;).val());&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Insert a container for the slider&lt;br /&gt;
				var container = $(&#039;&amp;lt;div class=&amp;quot;customSliderWrapper&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				var slider = $(&#039;&amp;lt;div id=&amp;quot;slider-&#039;+id+&#039;&amp;quot; class=&amp;quot;customSlider&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo(container).slider({&lt;br /&gt;
					min: firstVal,&lt;br /&gt;
					max: lastVal,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					value: currentVal,&lt;br /&gt;
					step: secondVal - firstVal,&lt;br /&gt;
					slide: function( event, ui ) {&lt;br /&gt;
						$(el).val(ui.value);&lt;br /&gt;
						$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
&lt;br /&gt;
				// Insert a callout&lt;br /&gt;
				var callout = $(&#039;&amp;lt;div id=&amp;quot;callOut-&#039;+id+&#039;&amp;quot; class=&amp;quot;slider_callout slider-callout&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo($(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;)).text($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Set a value as soon as the slider handle is clicked&lt;br /&gt;
				$(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;).mousedown(function() {&lt;br /&gt;
					$(el).val(slider.slider(&#039;value&#039;));&lt;br /&gt;
					$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.customSliderWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 10px;&lt;br /&gt;
	padding-top: 1.75em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey Version 2.6x==&lt;br /&gt;
[[File:Dropdown-sliders.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.64.7 &#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
			&lt;br /&gt;
			// Identify this question&lt;br /&gt;
			var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
			thisQuestion.addClass(&#039;with-dropdown-sliders&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through all array drop-downs&lt;br /&gt;
			$(&#039;select.multiflexiselect&#039;, thisQuestion).each(function(i, el){&lt;br /&gt;
				var thisCell = $(el).closest(&#039;td&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = $(el).val();&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:eq(1)&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
&lt;br /&gt;
				// Insert an input for the slider&lt;br /&gt;
				var thisInput = $(&#039;&amp;lt;input class=&amp;quot;inserted-input&amp;quot; type=&amp;quot;text&amp;quot; /&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
				&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				thisInput.val(currentVal).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: firstVal,&lt;br /&gt;
					&#039;max&#039;: lastVal,&lt;br /&gt;
					&#039;step&#039;: secondVal - firstVal,&lt;br /&gt;
					&#039;value&#039;: Number(currentVal),&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Listener on the slider&lt;br /&gt;
				$(thisInput).on(&#039;slideStop&#039;, function () {&lt;br /&gt;
					if($(&#039;.tooltip&#039;, thisCell).is(&#039;:hidden&#039;)) {&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).show();&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).css(&#039;margin-left&#039;, &#039;-&#039;+($(&#039;.tooltip&#039;, thisCell).width()/2)+&#039;px&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(el).val($(thisInput).val());&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Hide the slider call-out if no value selected yet&lt;br /&gt;
				if(currentVal == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.tooltip&#039;, thisCell).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal {&lt;br /&gt;
    margin: 1.5em auto  1em auto;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey for version 2.6x: [[Media:Demo_Sliders_in_Array_Survey.zip|Demo_Sliders_in_Array_Survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Vertical Sliders=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, 2.00+, IE 9, Firefox 13, Chrome 19&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to apply vertical sliders to multiple-numeric questions. You can download a sample template here (with the plugin in template.js) - [[Media:default_vertical_sliders.zip|vertical slider template]] - and a sample survey here - [[Media:demo_vertical_sliders.lss|vertical slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:verticalsliders_1.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question(s). Do NOT use any of the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js. Replace &amp;quot;QQ&amp;quot; (line 5) with the question ID and adjust the options in the function call as desired. Repeat the call as many times as you need for more questions&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
	// Call the vertical slider plugin with the question ID&lt;br /&gt;
	// Edit options here as desired&lt;br /&gt;
	$(&#039;#questionQQ&#039;).lsVerticalSlider({&lt;br /&gt;
		minValue		:0,		// Minimum value (default 0)&lt;br /&gt;
		maxValue		:200,	// Maximum value (default 100)&lt;br /&gt;
		startValue		:100,	// Start value (default null)&lt;br /&gt;
		step			:10,	// Slider increments (default 1)&lt;br /&gt;
		height			:100,	// Height of slider in pixels (default 200)&lt;br /&gt;
		recordStart		:true,	// Record the start value? (default no)&lt;br /&gt;
		showMin			:true,	// Show minimum value? (default no)&lt;br /&gt;
		showMax			:true	// Show maximum value? (default no)&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
// NO EDITING REQUIRED BELOW HERE&lt;br /&gt;
// A jQuery plugin to convert multiple-numeric questions to vertical sliders&lt;br /&gt;
(function( $ ){&lt;br /&gt;
	$.fn.lsVerticalSlider = function(options) {&lt;br /&gt;
&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			minValue		:0,&lt;br /&gt;
			maxValue		:100,&lt;br /&gt;
			startValue		:&#039;&#039;,&lt;br /&gt;
			step			:1,&lt;br /&gt;
			height			:150,&lt;br /&gt;
			recordStart		:false,&lt;br /&gt;
			showMin			:false,&lt;br /&gt;
			showMax			:false&lt;br /&gt;
		}, options);&lt;br /&gt;
&lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
&lt;br /&gt;
			var $this = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Some classes for the question and subquestions&lt;br /&gt;
			$this.addClass(&#039;vertical-slider-question&#039;);&lt;br /&gt;
			$(&#039;li:[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).addClass(&#039;vertical-slider-subquestion&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through the subquestions&lt;br /&gt;
			$(&#039;li:[id&amp;lt;/div&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).each(function(i){&lt;br /&gt;
				var itemID = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) {&lt;br /&gt;
					opts.startValue = $(&#039;#answer&#039;+itemID).val();&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Insert the slider elements&lt;br /&gt;
				$(&#039;#answer&#039;+itemID).after(&lt;br /&gt;
					&#039;&amp;lt;div class=&amp;quot;vertical-slider-max-min&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-max&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-min&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div id=&amp;quot;vertical-slider-&#039;+itemID+&#039;&amp;quot; class=&amp;quot;vertical-slider&amp;quot; style=&amp;quot;height:&#039;+opts.height+&#039;px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div class=&amp;quot;vertical-slider-callout-wrapper&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-callout&amp;quot; id=&amp;quot;slider-callout-&#039;+itemID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt;&#039;&lt;br /&gt;
				);&lt;br /&gt;
&lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.vertical-slider-max&#039;, $this).text(opts.maxValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.vertical-slider-min&#039;, $this).text(opts.minValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				$(&#039;#vertical-slider-&#039;+itemID).slider({&lt;br /&gt;
					orientation: &#039;vertical&#039;,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					min: opts.minValue,&lt;br /&gt;
					max: opts.maxValue,&lt;br /&gt;
					value: opts.startValue,&lt;br /&gt;
					step: opts.step,&lt;br /&gt;
					slide: function(event, ui) {&lt;br /&gt;
						$(&#039;#answer&#039;+itemID).val(ui.value);&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).text(ui.value);&lt;br /&gt;
						setTimeout(function() {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) }).show();&lt;br /&gt;
						}, 10);&lt;br /&gt;
					},&lt;br /&gt;
					create: function(event, ui) {&lt;br /&gt;
						// Initial values and positions&lt;br /&gt;
						if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) { // Pre-existing answer&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else if(opts.recordStart) { // Record the start value (if option is set)&lt;br /&gt;
							$(&#039;#answer&#039;+itemID).val(opts.startValue);&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).hide();&lt;br /&gt;
						}&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) });&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Vertical slider styles and overrides */&lt;br /&gt;
.vertical-slider-question p.tip {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-subquestion {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 0 3em 0 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question label {&lt;br /&gt;
	display: block;&lt;br /&gt;
	padding: 0 0 0.75em 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question span.input {&lt;br /&gt;
	padding: 0.3em 0 0 0;&lt;br /&gt;
	display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question input.text {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider {&lt;br /&gt;
	float: left;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question .ui-slider-handle {&lt;br /&gt;
	top: auto;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min,&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	position: relative;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	min-width: 3em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min {&lt;br /&gt;
	margin-right: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max,&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	font-size: 0.8em;&lt;br /&gt;
	color:#666666;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max {&lt;br /&gt;
	margin-top: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	right: 0;&lt;br /&gt;
	bottom: 0;&lt;br /&gt;
	margin-bottom: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	top: auto;&lt;br /&gt;
	margin: 0 0 -0.6em 0.5em;&lt;br /&gt;
	padding: 0.1em;&lt;br /&gt;
	font-size: 0.9em;&lt;br /&gt;
	color:#000000;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	background: #F8F8FF;&lt;br /&gt;
	border: 1px solid #D2E0F2;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Range Slider=&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert a jQuery UI range slider into a multi-numeric question and automatically populate that question&#039;s inputs with the range min and max values.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039;: [[Media:Demo_Range_Slider_2.5x.zip|Sample Template and Survey.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_Range_Slider_2.5x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin handles:&lt;br /&gt;
*previous answers&lt;br /&gt;
*slider max/min&lt;br /&gt;
*range min start&lt;br /&gt;
*range max start&lt;br /&gt;
*range span min&lt;br /&gt;
*slider step&lt;br /&gt;
*record the start values&lt;br /&gt;
*show slider max and min&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;LimeSurvey 2.5x&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A multiple-numeric question with two subquestions&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create your multi-numeric question. Do NOT use any of the slider advanced settings.&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A jQuery plugin to display a range slider in LimeSurvey&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.lsRangeSlider = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:100, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:&#039;&#039;, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:&#039;&#039;, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:false, // Record the start value? (default no)&lt;br /&gt;
			showMin			:false, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:false // Show slider maximum value? (default no)&lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
 &lt;br /&gt;
			if($(this).hasClass(&#039;numeric-multi&#039;) &amp;amp;&amp;amp; $(&#039;input.text&#039;, this).length == 2) {&lt;br /&gt;
 &lt;br /&gt;
				// Define some vars	&lt;br /&gt;
				var thisQuestion = $(this);&lt;br /&gt;
				var rangeMinInput = $(&#039;input.text.form-control:eq(0)&#039;, thisQuestion); &lt;br /&gt;
				var rangeMaxInput = $(&#039;input.text.form-control:eq(1)&#039;, thisQuestion); &lt;br /&gt;
				thisQuestion.addClass(&#039;range-slider-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() != &#039;&#039;) {&lt;br /&gt;
					opts.rangeStartMin = $(rangeMinInput).val();&lt;br /&gt;
					opts.rangeStartMax = $(rangeMaxInput).val();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					if(opts.rangeStartMin == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMin = opts.sliderMin;&lt;br /&gt;
					}&lt;br /&gt;
					if(opts.rangeStartMax == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMax = opts.sliderMax;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
		&lt;br /&gt;
				// Insert the slider&lt;br /&gt;
				var insertedEls = &#039;&amp;lt;div class=&amp;quot;col-xs-12 col-sm-12 withslider&amp;quot;&amp;gt;\&lt;br /&gt;
										&amp;lt;input class=&amp;quot;inserted-slider&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;rangeSlider&amp;quot; /&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-left&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-min&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-right&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-max&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;].form-control:eq(0)&#039;, thisQuestion).closest(&#039;.subquestion-list&#039;).hide().before(insertedEls);&lt;br /&gt;
				&lt;br /&gt;
				var sliderValues = [Number(opts.rangeStartMin), Number(opts.rangeStartMax)];&lt;br /&gt;
			&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: Number(opts.sliderMin),&lt;br /&gt;
					&#039;max&#039;: Number(opts.sliderMax),&lt;br /&gt;
					&#039;step&#039;: Number(opts.step),&lt;br /&gt;
					&#039;range&#039;: true,&lt;br /&gt;
					&#039;value&#039;: sliderValues,&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider .tooltip&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
						&lt;br /&gt;
				// Listener on the range slider&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slideStart&#039;, function(event, ui) {&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slide slideStop&#039;, function(event, ui) {&lt;br /&gt;
					var thisLowerVal = Number($.trim($(this).val().split(&#039;,&#039;)[0]));&lt;br /&gt;
					var thisUpperVal = Number($.trim($(this).val().split(&#039;,&#039;)[1]));&lt;br /&gt;
					if(opts.minRangeSpan &amp;gt; 0 &amp;amp;&amp;amp; (thisUpperVal-thisLowerVal) &amp;lt; opts.minRangeSpan) {&lt;br /&gt;
						$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider(&#039;setValue&#039;, sliderValues);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(thisLowerVal);&lt;br /&gt;
						$(rangeMaxInput).val(thisUpperVal);&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
						sliderValues = [thisLowerVal, thisUpperVal];&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
 &lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.inserted-slider-min&#039;, thisQuestion).text(opts.sliderMin);&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.inserted-slider-max&#039;, thisQuestion).text(opts.sliderMax);&lt;br /&gt;
				}&lt;br /&gt;
				&lt;br /&gt;
				// Handle recordStart&lt;br /&gt;
				if(opts.recordStart) {&lt;br /&gt;
					if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[0])));&lt;br /&gt;
						$(rangeMaxInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[1])));&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider({&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:10, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:2, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:8, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:true, // Record the start value? (default no)&lt;br /&gt;
			showMin			:true, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:true // Show slider maximum value? (default no)&lt;br /&gt;
		});&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Or, to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider();&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Reverse Slider=&lt;br /&gt;
&lt;br /&gt;
{{Box|The reverse slider feature can be used in any (multiple) numerical input question type. For more details, please check the [[Question_type_-_Multiple_numerical_input#Slider|slider wiki subsection]].}}&lt;br /&gt;
&lt;br /&gt;
=Sliders With Control Buttons=&lt;br /&gt;
== Version 2.05 ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 7-10, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert &amp;quot;up&amp;quot; and &amp;quot;down&amp;quot; buttons to control sliders. You can download a sample template here - [[Media:Demo_Slider_Buttons.zip|slider with buttons template]] - and a sample survey here - [[Media:Limesurvey_survey_button_slider.lss|button slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:Button_slider.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin allows the following options:&lt;br /&gt;
*Down Text: Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
*Up Text: Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
*Scrolling: Continuous slider movement if the left mouse button is held down&lt;br /&gt;
*Scroll Interval: Interval (in milliseconds) between slider movement when button is held down (do not make this too short or it will be difficult to stop the slider accurately)&lt;br /&gt;
*Value Prefix: Prefix for call-out&lt;br /&gt;
*Value Suffix: Suffix for call-out&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A custom plugin to add control buttons to LimeSurvey sliders&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.sliderButtons = function(options) {&lt;br /&gt;
	&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
		downText: &#039;-&#039;,		// Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
		upText: &#039;+&#039;,		// Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
		scrolling: true,	// Continuous slider movement if left mouse button held down&lt;br /&gt;
		scrollInterval: 150,// Interval (in ms) between slider movement when button is held down&lt;br /&gt;
		valuePrefix: &#039;&#039;,	// Prefix for callout&lt;br /&gt;
		valueSuffix: &#039;&#039;	// Suffix for callout&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function(i) {&lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
	&lt;br /&gt;
			// Add some classes&lt;br /&gt;
			$(thisQuestion).addClass(&#039;slider-button-question&#039;);		&lt;br /&gt;
			&lt;br /&gt;
			// Insert the buttons&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;slider-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button down&amp;quot;&amp;gt;&#039;+opts.downText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button up&amp;quot;&amp;gt;&#039;+opts.upText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
														&amp;lt;/div&amp;gt;&#039;);			&lt;br /&gt;
			&lt;br /&gt;
			// Initial button states&lt;br /&gt;
			function handleButtonState(slider) {&lt;br /&gt;
				var thisRow = $(slider).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSliderVal = $(slider).slider(&#039;option&#039;, &#039;value&#039;);&lt;br /&gt;
				var thisSliderStep = $(slider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var thisSliderMin = $(slider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(slider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisRow).prop(&#039;disabled&#039;, false);&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMin) {&lt;br /&gt;
					$(&#039;button.slider-button.down&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMax) {&lt;br /&gt;
					$(&#039;button.slider-button.up&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				handleButtonState(this);	&lt;br /&gt;
				if($(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val() != &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider-callout&#039;, this).text(opts.valuePrefix+$(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val()+opts.valueSuffix);&lt;br /&gt;
				}&lt;br /&gt;
			});	&lt;br /&gt;
			&lt;br /&gt;
			// Function to handle button actions&lt;br /&gt;
			function handleButtons(thisButton) {&lt;br /&gt;
				var thisRow = $(thisButton).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSlider = $(&#039;.multinum-slider&#039;, thisRow);&lt;br /&gt;
				var thisSliderStep = $(thisSlider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var stepDecimals = 0;&lt;br /&gt;
				if(thisSliderStep.toString().indexOf(&#039;.&#039;) &amp;gt;= 0) {&lt;br /&gt;
					stepDecimals = thisSliderStep.toString().split(&#039;.&#039;)[1].length;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSliderVal = Number($(thisSlider).slider(&#039;option&#039;, &#039;value&#039;)).toFixed(stepDecimals);&lt;br /&gt;
				var thisSliderMin = $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;down&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;gt; thisSliderMin) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)-Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;up&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;lt; thisSliderMax) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)+Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				var newValue = $(thisSlider).slider(&#039;option&#039;, &#039;value&#039;).toFixed(stepDecimals).replace(/\./, LSvar.sLEMradix);&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(newValue).triggerHandler(&#039;keyup&#039;);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisSlider).text(opts.valuePrefix+newValue+opts.valueSuffix);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Scrolling&lt;br /&gt;
			if(opts.scrolling == true) {&lt;br /&gt;
					&lt;br /&gt;
				var sliderTimeout;&lt;br /&gt;
				var clicker = $(&#039;button.slider-button&#039;, thisQuestion);&lt;br /&gt;
				var count = 0;&lt;br /&gt;
&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mousedown(function(){&lt;br /&gt;
					var thisButton = $(this);&lt;br /&gt;
					sliderTimeout = setInterval(function(){&lt;br /&gt;
						handleButtons(thisButton);&lt;br /&gt;
					}, opts.scrollInterval);				&lt;br /&gt;
					return false;&lt;br /&gt;
				});				&lt;br /&gt;
				&lt;br /&gt;
				$(document).mouseup(function(){&lt;br /&gt;
					clearInterval(sliderTimeout);&lt;br /&gt;
					return false;&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mouseout(function(){&lt;br /&gt;
					handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Listener on the buttons&lt;br /&gt;
			$(&#039;button.slider-button&#039;, thisQuestion).click(function(e) {&lt;br /&gt;
				handleButtons(this)	;		&lt;br /&gt;
				handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on sliders&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function( event, ui ) {&lt;br /&gt;
				handleButtonState(this);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on reset buttons&lt;br /&gt;
			$(&#039;.slider-reset&#039;, thisQuestion).on( &amp;quot;click&amp;quot;, function( event, ui ) {&lt;br /&gt;
				var thisReset = $(this);&lt;br /&gt;
				setTimeout(function() {&lt;br /&gt;
					handleButtonState($(thisReset).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				}, 150);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template but easily modified for others):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.slider-button-question label.slider-label {&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    padding: 40px 1em 0 0;&lt;br /&gt;
    *padding: 25px 1em 0 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question div.multinum-slider {&lt;br /&gt;
	margin-top: 45px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .ui-slider-horizontal .ui-slider-handle {&lt;br /&gt;
	width: 18px;&lt;br /&gt;
    margin-left: -9px;&lt;br /&gt;
    top: -4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider_callout {&lt;br /&gt;
    margin-left: -41px;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
    width: 100px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 40px 0 0 25px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button {&lt;br /&gt;
	padding: 0 10px;&lt;br /&gt;
	margin: 0 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button:disabled {&lt;br /&gt;
	opacity:0.65;&lt;br /&gt;
	filter:alpha(opacity=65);&lt;br /&gt;
	cursor: default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-reset {&lt;br /&gt;
	margin-top: 42px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons({&lt;br /&gt;
			downText: &#039;Down&#039;, // Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
			upText: &#039;Up&#039;, // Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
			scrolling: true, // Continuous slider movement if left mouse button held down&lt;br /&gt;
			scrollInterval: 250, // Interval (in ms) between slider movement when button is held down&lt;br /&gt;
			valueSuffix: &amp;quot;%&amp;quot;	// Suffix for callout&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Or, simply to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons();&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Slider Control Buttons for LimeSurvey 3.x can be found here - https://github.com/tpartner/LimeSurvey-Slider-Controls-3x&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176532</id>
		<title>Workarounds: Question design, layout and templating</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176532"/>
		<updated>2023-05-11T17:30:12Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Star Rating System Using List (Radio) Question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This section more or less deals with styling your survey, adjusting the layout and setting up special question types. You can find &#039;&#039;&#039;similar information&#039;&#039;&#039; at these pages:&lt;br /&gt;
* [[The template editor]]&lt;br /&gt;
* [[Workarounds: Manipulating a survey at runtime using Javascript]]&lt;br /&gt;
* [[Workarounds: Survey behaviour]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves. &amp;lt;span style=&#039;color:#EE0000&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Different progress indicator=&lt;br /&gt;
&lt;br /&gt;
==Version 1.87 and later:==&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will find the progress value and insert it into the element following the progress bar.&lt;br /&gt;
&lt;br /&gt;
It should be pointed out that I had to introduce a delay in firing the function because the progress value is not calculated until after template.js is called. The delay is set at 1/10 of a second but you may be able to reduce that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // Display progress value&lt;br /&gt;
&lt;br /&gt;
   function setProgValue() {&lt;br /&gt;
&lt;br /&gt;
       var progress = $(&#039;#progressbar&#039;).attr(&#039;aria-valuenow&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).text(progress+&#039;%&#039;).show();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
       setTimeout(&#039;setProgValue()&#039;,100);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to hide the &amp;quot;0%&amp;quot; before the progress bar, add the following to the end of template.css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
#progress-pre {&lt;br /&gt;
&lt;br /&gt;
   display: none;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Delete unwanted gaps in question title=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When copying data (questions, answers, ...) from MS Word or other applications into the editor there might occur some gaps in the question title.&lt;br /&gt;
&lt;br /&gt;
There are two solutions to this:&lt;br /&gt;
# Use popup mode and manually delete unwanting extra html tags (requires html knowledge).&lt;br /&gt;
# Disable paste word feature: Tweak your limesurvey-config.js file in limesurvey/admin/scripts/fckeditor.26 and set the following option to true:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;FCKConfig.ForcePasteAsPlainText = true ;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that clear you browser cache and try again.&lt;br /&gt;
&lt;br /&gt;
=How to change the &amp;lt;font-size&amp;gt; tags using CSS=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This workaround was deleted because it is outdated. Such changes can be done by [[The template editor#Styling questions with CSS|adjusting template.css]] of your template.&lt;br /&gt;
&lt;br /&gt;
=Question type variation: Scale with bars (one and two sided)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some methodogical issues to think about: Very often a common scale as 1 to 5 or -2 to +2 fits all needs, as the shown subject is clearly defined as positive or negative. As soon as you would reduce the influence from the question and scale on the respondent, you will need something neutral to determine tendences, emphases and so on.&lt;br /&gt;
&lt;br /&gt;
So I put up a new variation of the one and two sided array question:&lt;br /&gt;
&lt;br /&gt;
ttp://www.limesurvey.org/images/fbfiles/images/example_bar_scale.jpg&lt;br /&gt;
&lt;br /&gt;
In my example the left side reads &amp;quot;strategical planning&amp;quot; and the right side &amp;quot;operative business&amp;quot;. None of these are purely negative or positive, so the bars only show in which direction the balancing point moves.&lt;br /&gt;
&lt;br /&gt;
To realize a question as shown above just do as follows:&lt;br /&gt;
&lt;br /&gt;
Set up as many bars as you will need (in my example there are four different bars in total) with a graphic program like PAINT .NET, GIMP or similar ones (yes, you may also use commercial software like Photoshop). To prevent the bars from looking twitchy, designate the size in advance. I did one bar 60x15 px, one 45x15px, one 30x15px and at last 15x15px. Save them as PNG, JPG or GIF.&lt;br /&gt;
# Create a new label set within Lime. Call it whatever you like.&lt;br /&gt;
# Enter a code number at first, then press the pencil symbol to enter the editor.&lt;br /&gt;
#Press the &amp;quot;Insert / edit image&amp;quot; button and upload the bar you want to insert with the FCK upload tool. Then choose the uploaded picture, save and leave the FCK editor.&lt;br /&gt;
#The row in the lable editor now shows an &amp;lt;img&amp;gt;-tag which refers to your bar picture.&lt;br /&gt;
#Repeat the above described steps as often as needed to build up your bar scale.&lt;br /&gt;
&lt;br /&gt;
=Doing a Likert Scale=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A Likert Scale is a special type of the Semantic Differential question where several item shall be rated on different scales, each marked at the beginning and at the end with opposite statements. &lt;br /&gt;
&lt;br /&gt;
To do this in LimeSurvey just follow these steps:&lt;br /&gt;
#Create a label set with values from 0 to 7 (for the classic Likert Scale - feel free to choose other ranges).&lt;br /&gt;
#Create a new question and choose Array (Flexible Labels) as question type.&lt;br /&gt;
#Assign the Likert Scale label set to this question.&lt;br /&gt;
#Enter your answers as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;DIV style=&amp;quot;white-space: nowrap;&amp;quot;&amp;gt;ITEM statement1|statement2&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The white-space style is to avoid line breaks which would ruin the whole scale. feel free to insert non-breakable spaces between the ITEM and statement1 to define the margin between these to strings.&lt;br /&gt;
&lt;br /&gt;
=Alternate background colour of questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To alternate the background colour of questions, open the &#039;&#039;template.css&#039;&#039; of your template with the Template Editor or a text editor and modify the &#039;&#039;Question styles&#039;&#039; section to include the following style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
div#question2 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question4 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question6 td.questiontext {&lt;br /&gt;
&lt;br /&gt;
   background-color: #E0EBF8;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to apply the style to all of the questions you would like modified using their question IDs (&#039;&#039;question2, question4, question6&#039;&#039; in this case). Question IDs are displayed when creating or editing questions - see below:&lt;br /&gt;
&lt;br /&gt;
[[File:qid_1_493x173.gif]]&lt;br /&gt;
&lt;br /&gt;
Here the question ID is #question80 .&lt;br /&gt;
&lt;br /&gt;
=Embedding audio in questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191), IE 7, FireFox 3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Audio clips can be embedded in most question text or answer text. In this example, using the default template, I&#039;ve embedded clips into the answers of an &#039;&#039;&#039;&#039;&#039;Array (Yes/No/Uncertain)&#039;&#039;&#039;&#039;&#039; question to ask respondents how they feel about some sounds. The resulting question will look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x202.gif]]&lt;br /&gt;
&lt;br /&gt;
It&#039;s accomplished by placing the following code in each of the answers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;embed height=&amp;quot;20&amp;quot; width=&amp;quot;128&amp;quot; autostart=&amp;quot;false&amp;quot; controls=&amp;quot;console&amp;quot;&lt;br /&gt;
&lt;br /&gt;
loop=&amp;quot;true&amp;quot; volume=&amp;quot;50&amp;quot; src=&amp;quot;{TEMPLATEURL}audio_1.mp3&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some notes about the code:&lt;br /&gt;
*The &#039;&#039;audio_1.mp3&#039;&#039; part will be different for each answer (it&#039;s the audio file name).&lt;br /&gt;
*In this case the audio files are residing in the template folder being used for this survey (that&#039;s where &#039;&#039;{TEMPLATEURL}&#039;&#039; points to) but they can be placed anywhere if you use an absolute URL in the &#039;&#039;src&#039;&#039; parameter - something like &#039;&#039;src=&amp;quot;http://mysite.com/audio/audio_1.mp3&amp;quot;&#039;&#039;&lt;br /&gt;
*If the audio file doesn&#039;t exist where the &#039;&#039;src&#039;&#039; parameter indicates, the player will not appear.&lt;br /&gt;
*You&#039;ll need to insert the code into the answers using the source screen - click on &amp;quot;Edit answers&amp;quot;, click the pencil beside the text box, click &amp;quot;Source&amp;quot; in the pop-up, enter the code and save it with the little diskette icon.&lt;br /&gt;
*You may need to turn off the XSS filter - see the documentation for [http://docs.limesurvey.org/tiki-index.php?page=Global+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Security Global settings].&lt;br /&gt;
&lt;br /&gt;
Although the above example places the audio in the answer text of the question, the same principles can be used to place it in the question text itself. Something like this perhaps.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x154.gif]]&lt;br /&gt;
&lt;br /&gt;
=Hiding inputs of a &amp;quot;Multiple options with comments&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
There may be times when you want to hide some of the input boxes of a &#039;&#039;&#039;&#039;&#039;Multiple choice question type with comments&#039;&#039;&#039;&#039;&#039; question as in the image below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:hidden_inputs_541x168.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This can be accomplished with CSS (see [[The template editor#Styling questions with CSS|Styling questions in LimeSurvey 1.8]]). For each input that you want to hide, add the following style to your template.css file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
#answer11111X22X33Acomment {&lt;br /&gt;
   display: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where 11111 is your survey ID, 22 is your group ID, 33 is your question ID and A is the answer code.&lt;br /&gt;
&lt;br /&gt;
Note that you will still see columns for the hidden inputs in your data but they will be empty.&lt;br /&gt;
&lt;br /&gt;
=Multiple question types in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90 - 1.92+, IE 7/8/9, Firefox 13, Safari 5, Chrome 10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Media:limesurvey_survey_62584.lss|Download the sample survey]]&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present multiple question types in what appears to be an array - as depicted in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=62584&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here] (download the sample survey - [[Media:limesurvey_survey_62584.lss|limesurvey_survey_62584.lss]]). This example uses the default template but should be adaptable to any template using divisions for question containers.&lt;br /&gt;
&lt;br /&gt;
[[File:inline_questions_700x228.png]]&lt;br /&gt;
&lt;br /&gt;
Basically what we do is take groups of questions (5 in this case), wrap them in a division and make them line up nicely horizontally and vertically. The width of the survey is also fixed to prevent wrapping issues. We do this with a JavaScript/jQuery function that inserts the necessary wrappers and then modifies styles so everything behaves properly. The top row is 5 boilerplate questions with the &amp;quot;column headers&amp;quot; as question text (the first just has a blank space). The following rows are a boilerplate with the &amp;quot;row headers&amp;quot; followed by 4 assorted questions.&lt;br /&gt;
&lt;br /&gt;
It should be noted that using conditions on these questions may result in unexpected behavior. If a question is hidden by conditions, the question(s) to the right of it will move over to take its place.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Create your questions keeping in mind how they will lay out when grouped into rows (in this example - boilerplate, yes/no, short text, numeric, dropdown, and repeat).&lt;br /&gt;
#In the source of the first boilerplate question add the function below (see [http://manual.limesurvey.org/wiki/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F How to use script]).&lt;br /&gt;
#Modify the number of rows, number of columns and the start placement in the function call (line 6) as required (the example uses 4 rows and 5 columns and the &amp;quot;array&amp;quot; starts with the third question on the page).&lt;br /&gt;
&lt;br /&gt;
The code may look intimidating at first but it&#039;s actually fairly simple. I&#039;ve laid it out as sequentially as possible and purposely used few shortcuts and many comments to make it easier to follow.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
*If you use question types other than boilerplate, short text, list dropdown, numeric or yes-no, you&#039;ll need to add to the last section of code, where it hides the question text and formats the inputs for display this way.&lt;br /&gt;
*Any extra questions on the page should follow this grid of questions, not precede them.&lt;br /&gt;
* If you use boilerplate as question type you should add after:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
the following 2 lines&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
//repair boilerplate questioncells&lt;br /&gt;
$(&#039;div.boilerplate td.questiontext&#039;).parent().show();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Javascript code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the &amp;quot;sideBySide&amp;quot; function with number of rows, columns and start position&lt;br /&gt;
		sideBySide(4, 5, 3);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function sideBySide(rows, columns, startQuestion) {&lt;br /&gt;
&lt;br /&gt;
		/*********** Display multiple questions side by side ***********/&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;div.qRow1&#039;).length == 0) {&lt;br /&gt;
&lt;br /&gt;
			var rowNum = 0;&lt;br /&gt;
			var colNum = 1;&lt;br /&gt;
			var rowList = new Array();&lt;br /&gt;
&lt;br /&gt;
			//////// Add question classes for later use ////////&lt;br /&gt;
&lt;br /&gt;
			// Loop through all questions and add row and column specific classes&lt;br /&gt;
			$(&#039;div[id^=&amp;quot;question&amp;quot;]&#039;).each(function(i) {&lt;br /&gt;
				if(i &amp;gt;= (startQuestion-1) &amp;amp;&amp;amp; rowNum &amp;lt; rows) { // This IF condition only needed if there are questions before or following the &amp;quot;inline&amp;quot; questions&lt;br /&gt;
					$(this).addClass(&#039;qRow&#039;+rowNum+&#039;&#039;).addClass(&#039;qCol&#039;+colNum+&#039;&#039;).addClass(&#039;inlineQuestion&#039;);&lt;br /&gt;
					if(rowNum == 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;columnLabel&#039;);&lt;br /&gt;
					}  &lt;br /&gt;
					if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum == 1) {&lt;br /&gt;
						$(this).addClass(&#039;rowLabel&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;questionCell&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					if(colNum == columns) {&lt;br /&gt;
						rowList.push(&#039;qRow&#039;+rowNum+&#039;&#039;);&lt;br /&gt;
						rowNum++;&lt;br /&gt;
						colNum = 1;&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						colNum++;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).addClass(&#039;normalQuestion&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Survey layout manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Fix the width of the survey&lt;br /&gt;
			$(&#039;table.outerframe&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;900px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Wrap each &amp;quot;row&amp;quot; in a wrapper div&lt;br /&gt;
			$(rowList).each(function(i) {&lt;br /&gt;
				$(&#039;.&#039;+this+&#039;&#039;).wrapAll(&#039;&amp;lt;div id=&amp;quot;inlineWrapper&#039;+i+&#039;&amp;quot; class=&amp;quot;inlineRow&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Style the wrapper divs&lt;br /&gt;
			$(&#039;.inlineRow&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;850px&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0 auto 0 auto&#039;,&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.inlineRow:first&#039; ).css({&lt;br /&gt;
				&#039;margin-top&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get all the questions to sit politely side by side&lt;br /&gt;
			$( &#039;.inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;float&#039;: &#039;left&#039;,&lt;br /&gt;
				&#039;height&#039;:&#039;41px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;-8px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;.inlineQuestion .questionhelp&#039; ).hide();&lt;br /&gt;
			$( &#039;.inlineQuestion .survey-question-help&#039; ).parent().hide();&lt;br /&gt;
		   &lt;br /&gt;
			// A little space under the last row&lt;br /&gt;
			$( &#039;.inlineRow:last .inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Any questions not displayed inline (this is only needed if there are questions following the &amp;quot;inline&amp;quot; questions)&lt;br /&gt;
			$( &#039;.normalQuestion&#039; ).css({&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Column manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Set the column widths - can be set individually if necessary&lt;br /&gt;
			// Must add up to less than 100%&lt;br /&gt;
			$( &#039;.qCol1&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;12%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.qCol2, .qCol3, .qCol4, .qCol5&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;22%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Question manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Hide the answer element in boilerplate questions&lt;br /&gt;
			$( &#039;div.boilerplate td.answer&#039; ).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
			$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Push the question tables to 100%&lt;br /&gt;
			$( &#039;div.inlineRow table&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;100%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get everything to line up nicely vertically&lt;br /&gt;
			$( &#039;.inlineQuestion td.questiontext, .inlineQuestion td.answer p&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Adjust cell heights so everything lines up nicely horizontally&lt;br /&gt;
			$( &#039;.inlineQuestion td.answer, .inlineQuestion td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;35px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;0.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;#inlineWrapper0 .inlineQuestion&#039; ).css({ &#039;height&#039;:&#039;50px&#039; });&lt;br /&gt;
			$( &#039;#inlineWrapper0 td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;50px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Yes-no question styles&lt;br /&gt;
			$( &#039;div.yes-no ul&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;,&lt;br /&gt;
				&#039;font-size&#039;: &#039;90%&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0&#039;,&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;5px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no li&#039; ).css({&lt;br /&gt;
				&#039;padding-right&#039;: &#039;1.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no td.answer&#039; ).css({&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Short-text question styles&lt;br /&gt;
			$( &#039;div.text-short input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Numeric question styles&lt;br /&gt;
			$( &#039;div.numeric input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.numeric p.tip&#039; ).css({&lt;br /&gt;
				&#039;display&#039;: &#039;none&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get rid of the margins around select boxes&lt;br /&gt;
			$( &#039;p.question&#039; ).css({ &#039;margin&#039;:&#039;0&#039; });&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Star Rating System=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://www.fyneworks.com/jquery/star-rating/ jQuery Star Rating Plugin] to display a series of stars that are used to generate a rating value. This value is then passed to either a hidden numeric input question or a hidden list radio question. Both methods are outlined below - use one or both depending on whether you want to use [Assessments|assessments].&lt;br /&gt;
&lt;br /&gt;
The plugin uses a series of radio inputs to generate the stars (more about these below). It allows the use of whole or partial stars as shown in the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x324.png]]&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using Numeric Input Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like your rating data to be collected as a numeric value and don&#039;t want to use [[Assessments|LimeSurvey assessments]] - it&#039;s a little easier to implement.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#[http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
##jquery.MetaData.js&lt;br /&gt;
##jquery.rating.css&lt;br /&gt;
##jquery.rating.js&lt;br /&gt;
##delete.gif&lt;br /&gt;
##star.gif&lt;br /&gt;
#In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a numeric input question and then in the source of the question add as many radio inputs as star segments. For example, if you would like 5 stars, each with half-segments, you would need 10 radio inputs and that would give rating values from 1-10.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q1 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;6&amp;quot; value=&amp;quot;6&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;7&amp;quot; value=&amp;quot;7&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;8&amp;quot; value=&amp;quot;8&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;9&amp;quot; value=&amp;quot;9&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;10&amp;quot; value=&amp;quot;10&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. A note on split stars. The stars in the above example are split in half by the &#039;&#039;{ split:2 }&#039;&#039; metadata. So if you don&#039;t want split stars, your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
7. Finally, in the source of the question add the following function after your inputs. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the numeric input and pass the rating values into it as they are changed. If the rating is canceled the numeric input is nullified. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingNumeric(11111, 22, 1); handleRatingNumeric(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingNumeric (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the numeric input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val();&lt;br /&gt;
&lt;br /&gt;
   if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the numeric question&lt;br /&gt;
&lt;br /&gt;
handleRatingNumeric (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using List (Radio) Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like to use [[Assessments|assessments]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
&lt;br /&gt;
2. Set up the template to use custom onload functions. (See the [[Workarounds: Manipulating a survey at runtime using Javascript#Custom onload function|workaround here]])&lt;br /&gt;
&lt;br /&gt;
3. [http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
*jquery.MetaData.js&lt;br /&gt;
*jquery.rating.css&lt;br /&gt;
*jquery.rating.js&lt;br /&gt;
*delete.gif&lt;br /&gt;
*star.gif&lt;br /&gt;
&lt;br /&gt;
4. In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a list (radio) question with the same amount of sequentially numbered answers as star ratings. For example, if you want 5 whole-stars, you would create 5 answers, as in the image below, and this would give you ratings from 1-5. Note that the &amp;quot;Codes&amp;quot; and &amp;quot;Answers&amp;quot; must be sequential numbers.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x156_v2.png]]&lt;br /&gt;
&lt;br /&gt;
6. In the list (radio) question, set the [[Advanced question settings|hide_tip]] question attribute to 1&lt;br /&gt;
&lt;br /&gt;
7. In the source of the question add as many radio inputs as star segments. So 5 whole-stars (as in the demo Q2), would need 5 radio inputs.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q2 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. A note on split stars. The stars in the above example are whole-stars. If you want them split you need to add metadata to the class - something like &#039;&#039;{ split:2 }&#039;&#039;. So if you want half-stars your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
9. Finally, in the source of the question add the following function after your inputs. (See [http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure;=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ How to use script here])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the question radio buttons and toggle them as the rating values are changed. If the rating is canceled all question inputs are unchecked. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingRadio(11111, 22, 1); handleRatingRadio(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Onload code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingRadio (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the radio input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#question&#039; + qID + &#039; input.radio[checked=true]&#039;).attr(&#039;value&#039;);&lt;br /&gt;
&lt;br /&gt;
   //if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
   if ( rating ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio[value=&#039; + rating + &#039;]&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the radio question&lt;br /&gt;
&lt;br /&gt;
handleRatingRadio (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable column widths in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define all column widths of an array question - as shown in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here]. This example uses the default template shipped with 7557 but should be adaptable to any template.&lt;br /&gt;
&lt;br /&gt;
[[File:array_widths_701x226.gif]]&lt;br /&gt;
&lt;br /&gt;
We use a function to remove all of the widths imposed by the core code and then insert our own.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects documentation here]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Replace all instances of QQ with the question ID.&lt;br /&gt;
#In the third section of code, adjust the widths and add/remove columns as necessary. This example is for an array with a question text column followed by 3 answer columns as shown above.&lt;br /&gt;
#In the final section adjust the question text alignment to your liking&lt;br /&gt;
&lt;br /&gt;
Onload code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // Get rid of all the widths that the API imposes&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question col&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question thead td&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define a width for the question table so we can do so for its children&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Keep this to 95% or less so IE will behave&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question&#039; ).attr(&#039;width&#039;, &#039;95%&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define the column widths&lt;br /&gt;
&lt;br /&gt;
   // Add or remove columns and adjust widths as necessary but widths should add up to 100%&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Columns must be sequentially numbered starting at 0 - eg, td:eq(0), td:eq(1), td:eq(2).....&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th:eq(0)&#039; ).css({ &#039;width&#039;:&#039;10%&#039; }); // Answer text column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(0)&#039; ).css({ &#039;width&#039;:&#039;50%&#039; }); // First answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(1)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Second answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(2)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Third answer column&lt;br /&gt;
&lt;br /&gt;
   // Push the text input widths to 95% of their parent containers&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question input[type=&amp;quot;text&amp;quot;]&#039; ).css({ &#039;width&#039;:&#039;95%&#039; });&lt;br /&gt;
&lt;br /&gt;
   // Align the answer text - feel free to experiment&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th&#039; ).css({&#039;text-align&#039;:&#039;center&#039;});&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use images for radio buttons and checkboxes=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.92/2.0, using IE 9, FireFox 13, Chrome 16, Safari 5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses an adaptation of the jQuery imagetick.js plugin to replace the default radio buttons and checkboxes with images as pictured below:&lt;br /&gt;
&lt;br /&gt;
[[File:images.png]] &lt;br /&gt;
&lt;br /&gt;
This adaptation will work in the following question types:&lt;br /&gt;
*Array&lt;br /&gt;
*Array by column&lt;br /&gt;
*Array dual scale&lt;br /&gt;
*Array (5 point choice)&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
*Array (Increase-Same-Decrease)&lt;br /&gt;
*Array (Yes-No-Uncertain)&lt;br /&gt;
*Gender&lt;br /&gt;
*Yes-No&lt;br /&gt;
*Multiple choice&lt;br /&gt;
*Multiple choice with comments&lt;br /&gt;
*5 point choice&lt;br /&gt;
*List (Radio)&lt;br /&gt;
*List with comment&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey 2.0 and later implementation==&lt;br /&gt;
&lt;br /&gt;
Follow the instructions above with these changes:&lt;br /&gt;
#Download [[Media:Imagetick_lime_v2.1.zip|this modified version of the plugin for 2.0 and up]] instead of the one mentioned above and add all contained files to your template directory.&lt;br /&gt;
#Add these lines to the &amp;lt;head&amp;gt; element in your startpage.pstpl instead of the one above:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}imagetick_lime_2.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}imagetick_lime_2.css&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thanks to Jordan Boesch for the original plugin.&lt;br /&gt;
&lt;br /&gt;
=Changing the position and layout of an individual question using &amp;quot;question code&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (6536)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use this very flexible workaround you first have to apply a minor change to the question.pstpl of the used template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
needs to be changed to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this change won&#039;t change anything in the layout and can be left in the template even if you don&#039;t need this workaround. It&#039;s just a means to have a handle to actually change individual questions.&lt;br /&gt;
&lt;br /&gt;
You can then use a code such as the following in the question text to make question specific format changes. &amp;quot;SAMPLE&amp;quot; needs to be replaced with the concerning question code and javascript has to be allowed ([[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|older versions of limesurvey]], under global settings for newer versions).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.borderTop= &amp;quot;0px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginTop= &amp;quot;-62px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginLeft= &amp;quot;30px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sample code will hide the border at the top of the question, will move the whole question up by 62px and to the right by 30px. Using this workaround you can change a whole a lot of things concerning format and positions of a specific question without changing all the questions. A (German) list of all the allowed options can be found [http://de.selfhtml.org/javascript/objekte/style.htm#style_eigenschaften here].&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
==Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Assign a label set to the question - these will be the labels in the center column.&lt;br /&gt;
#Set the second parameter of the function call to true for randomized rows.&lt;br /&gt;
#Adjust the styles in lines 21-24 as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The script moves the question columns into the MaxDiff configuration and disables the opposing radio element when a selection is made.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
	&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, false);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function maxDiff(qID, randomize) {&lt;br /&gt;
		&lt;br /&gt;
		// Random number between 1 and 2&lt;br /&gt;
		// Math.floor(Math.random() * (max - min + 1)) + min;&lt;br /&gt;
		var randomNum = Math.floor(Math.random() * ((2-1)+1) + 1);&lt;br /&gt;
&lt;br /&gt;
		// Move the columns&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col:eq(1)&#039;).prependTo(&#039;colgroup.col-responses&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list thead tr:eq(0) th:eq(0)&#039;).prependTo(&#039;#question&#039;+qID+&#039; table.question thead tr:eq(0)&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Random rows&lt;br /&gt;
		if(randomize) {&lt;br /&gt;
			var rowsArr = [];&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
				$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
				rowsArr.push(i);&lt;br /&gt;
			});&lt;br /&gt;
			shuffleArray(rowsArr);&lt;br /&gt;
			$(rowsArr).each(function(i){&lt;br /&gt;
				$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody&#039;).append($(&#039;#question&#039;+qID+&#039; tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Style stuff&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col.odd&#039;).css({ &#039;background-color&#039;:&#039;transparent&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody th&#039;).css({ &#039;text-align&#039;:&#039;center&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:even td, #question&#039;+qID+&#039; table.question tbody tr:even th&#039;).css({ &#039;background-color&#039;:&#039;#F1F1F1&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:odd td, #question&#039;+qID+&#039; table.question tbody tr:odd th&#039;).css({ &#039;background-color&#039;:&#039;#FCFCFC&#039; });&lt;br /&gt;
&lt;br /&gt;
		// Prevent clicking twice in the same row&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input.radio&#039;).on(&#039;click&#039;, function () {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio&#039;).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio:checked&#039;).each(function(i) {&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				$(&#039;input.radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function shuffleArray(array) {&lt;br /&gt;
		for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
			var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
			var temp = array[i];&lt;br /&gt;
			array[i] = array[j];&lt;br /&gt;
			array[j] = temp;&lt;br /&gt;
		}&lt;br /&gt;
		return array;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Versions 2.5 and 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:MaxDiff_2.5.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Template.zip|Demo template]]&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Survey.zip|Demo survey]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Add 2 subquestions to the array - these will be the left and right columns.&lt;br /&gt;
#Add answers to the array - these will be the rows.&lt;br /&gt;
#Create a copy the default template.&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.js&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function maxDiff(qID, randomize) {&lt;br /&gt;
 &lt;br /&gt;
	// Identify some elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisTable = $(&#039;table.subquestion-list:eq(0)&#039;, thisQuestion);&lt;br /&gt;
 &lt;br /&gt;
	// Assign a new question class&lt;br /&gt;
	$(thisQuestion).addClass(&#039;max-diff-array&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Move the columns&lt;br /&gt;
	$(&#039;thead tr:eq(0)&#039;, thisTable).prepend($(&#039;thead tr:eq(0) th:eq(1)&#039;, thisTable));&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
		$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Random rows&lt;br /&gt;
	if(randomize) {&lt;br /&gt;
		var rowsArr = [];&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
			$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
			rowsArr.push(i);&lt;br /&gt;
		});&lt;br /&gt;
		shuffleArray(rowsArr);&lt;br /&gt;
		$(rowsArr).each(function(i){&lt;br /&gt;
			$(&#039;tbody&#039;, thisTable).append($(&#039;tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;, thisTable));&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	// Prevent clicking twice in the same row&lt;br /&gt;
	$(&#039;input:radio&#039;, thisQuestion).on(&#039;click&#039;, function () {&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;input:radio&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		$(&#039;input:radio:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr.answers-list&#039;);&lt;br /&gt;
			$(&#039;input:radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		});&lt;br /&gt;
	});	&lt;br /&gt;
 &lt;br /&gt;
	// Fix up the row classes&lt;br /&gt;
	var rowClass = 1;&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i) {&lt;br /&gt;
		$(this).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.css&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.max-diff-array th.answertext { &lt;br /&gt;
	text-align: center;&lt;br /&gt;
	border-right: 3px solid #FFFFFF;&lt;br /&gt;
	border-left: 3px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
/* Override the responsive &amp;quot;no-more-tables&amp;quot; stuff */&lt;br /&gt;
@media only screen and (max-width: 801px) {&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables table {&lt;br /&gt;
		display: table;&lt;br /&gt;
		border-collapse: inherit;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables thead, &lt;br /&gt;
	.max-diff-array .no-more-tables tbody {&lt;br /&gt;
		display: table-row-group;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables tr {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		position: relative;&lt;br /&gt;
		top: auto;&lt;br /&gt;
		display: table-row;&lt;br /&gt;
		border: 0 none;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables th, &lt;br /&gt;
	.max-diff-array .no-more-tables td {&lt;br /&gt;
		display: table-cell;&lt;br /&gt;
		text-align: center !important;&lt;br /&gt;
		color: #2c3e50;&lt;br /&gt;
		font-size: 15px;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array th.answertext { &lt;br /&gt;
		border-right: 3px solid #FFFFFF;&lt;br /&gt;
		border-left: 3px solid #FFFFFF;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .answer-item label span {&lt;br /&gt;
		display: none !important;&lt;br /&gt;
	}	&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add a script like this to the question source of the Array (flexible labels) question:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	   &lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, true);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Load SVG Code From Drawing Tool=&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to load a drawing tool and store the results in a huge-text question. The details are outlined in the [[Workarounds: Manipulating a survey at runtime using Javascript#Load SVG Code From Drawing Tool|JavaScript section of the workarounds]].&lt;br /&gt;
&lt;br /&gt;
=Minimum or Maximum Date in Datepicker=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note: From version 2.05 beta6, you MUST set the minimum and maximum date for the date picker directly in the advanced question attributes of the date/time question. This workaround will seize to work.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can set the minimum or maximum selectible date in a datepicker as follows&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]] and add the following to the source of the date question text or help. Replace &amp;quot;QQ&amp;quot; with the date question ID.&lt;br /&gt;
&lt;br /&gt;
For a minimum date of April 15, 2010:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date(2010, 4-1, 15) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a minimum date of the current date (today):&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date() );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a maximum date of May 10, 2015:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date(2015, 5-1, 10) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More details here - http://jqueryui.com/demos/datepicker/#option-minDate&lt;br /&gt;
&lt;br /&gt;
=Evaluative Space Grid (ESG)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 &amp;amp; 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The evaluative space grid (ESG) is a two-dimensional grid that provides a single-item measure of positivity and negativity (Larsen et al, 2009). See [http://leeds-faculty.colorado.edu/mcgrawp/pdf/larsen.norris.mcgraw.hawkley.cacioppo.2009.pdf page 4 of this PDF].&lt;br /&gt;
&lt;br /&gt;
This can be accomplished using a multiple-numeric question, some simple HTML and a little JavaScript.&lt;br /&gt;
&lt;br /&gt;
A table can be shown in the question. When a respondent clicks a grid cell in the table JavaScript loads the coordinates of the cell into the multiple-numeric question inputs.&lt;br /&gt;
&lt;br /&gt;
[[File:Space_grid_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create a Multiple Numeric question with two subquestions labelled &amp;quot;X&amp;quot; and &amp;quot;Y&amp;quot;.&lt;br /&gt;
#Add the following HTML to the source of the question to create the table:&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;spaceGrid&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td rowspan=&amp;quot;5&amp;quot; class=&amp;quot;yAxisLabel&amp;quot;&amp;gt;How NEGATIVE&amp;lt;br&amp;gt;&lt;br /&gt;
			do you feel about&amp;lt;br&amp;gt;&lt;br /&gt;
		the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td colspan=&amp;quot;5&amp;quot; class=&amp;quot;xAxisLabel&amp;quot;&amp;gt;How POSITIVE do you feel about the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following styles to the end of your template.css file:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.spaceGrid {&lt;br /&gt;
	width: auto;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.spaceGrid td {&lt;br /&gt;
	padding: 0 3px;&lt;br /&gt;
	text-align: center !important;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xAxisLabel {&lt;br /&gt;
	padding-top: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yAxisLabel {&lt;br /&gt;
	padding-right: 10px;&lt;br /&gt;
	width: 125px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xLabel {&lt;br /&gt;
	height: 20px;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yLabel {&lt;br /&gt;
	text-align: right !important;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.gridCell {&lt;br /&gt;
	width: 70px;&lt;br /&gt;
	height: 70px;&lt;br /&gt;
	border: 1px solid #666666;&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.checkedCell {&lt;br /&gt;
	background-color: #66FF00;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of your template.js file:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;	&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
	$(&#039;.spaceGrid&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
		// Define some vars&lt;br /&gt;
		var thisQuestion = $(this).closest(&#039;.numeric-multi&#039;);&lt;br /&gt;
		var thisTable = $(this).closest(&#039;table.spaceGrid&#039;);&lt;br /&gt;
		var numGridCell = $(&#039;.gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numCols = $(&#039;tr:eq(0) .gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numRows = numGridCell/numCols;&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers list&lt;br /&gt;
		$(&#039;.subquestion-list, .questions-list&#039;, thisQuestion).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Initial state&lt;br /&gt;
		var xCoord = $(&#039;input.text:eq(0)&#039;, thisQuestion).val() - 1;&lt;br /&gt;
		var yCoord = numRows - $(&#039;input.text:eq(1)&#039;, thisQuestion).val();&lt;br /&gt;
		$(&#039;tr:eq(&#039;+yCoord+&#039;) .gridCell:eq(&#039;+xCoord+&#039;)&#039;, thisTable).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the grid cells&lt;br /&gt;
		$(&#039;.gridCell&#039;).click(function(){&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Add class to checked cell&lt;br /&gt;
			$(&#039;.checkedCell&#039;, thisQuestion).removeClass(&#039;checkedCell&#039;);&lt;br /&gt;
			$(this).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Find the cell coordinates&lt;br /&gt;
			var reverseRowIndex = (numRows - $(&#039;tr&#039;, thisTable).index($(thisRow)));&lt;br /&gt;
			var colIndex = $(&#039;.gridCell&#039;, thisRow).index($(this)) + 1;&lt;br /&gt;
	&lt;br /&gt;
			// Load coordinates into inputs&lt;br /&gt;
			$(&#039;input.text:eq(0)&#039;, thisQuestion).val(colIndex);&lt;br /&gt;
			$(&#039;input.text:eq(1)&#039;, thisQuestion).val(reverseRowIndex);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The script should automatically handle different grid sizes.&lt;br /&gt;
&lt;br /&gt;
=Slider Highlighting=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may want to highlight a slider after it has been moved/changed to allow respondents to easily see which slider subquestions have been answered.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture.PNG]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;template.js&#039;&#039;&#039;:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&#039;html&#039;).bind(&#039;slidecreate&#039;, function(event, ui) {&lt;br /&gt;
	$(&#039;.slider_callout&#039;).each(function(i){&lt;br /&gt;
		if($(this).text().length &amp;gt; 0) {&lt;br /&gt;
			$(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	$(&#039;.ui-slider-horizontal&#039;).bind(&#039;slidechange&#039;, function(event, ui) {&lt;br /&gt;
	 $(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and would need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.numeric-multi .answer li {&lt;br /&gt;
	border-bottom: 5px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li label {&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li div.multinum-slider {&lt;br /&gt;
	margin: 1.5em 0.5em 0.2em 0;&lt;br /&gt;
	padding-left: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ui-slider-1 {&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.changedSlider {&lt;br /&gt;
	background-color: #99FFFF;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Dynamic Slider Call-Out Styles=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 9-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is an example of how to insert a custom &#039;&#039;&#039;&#039;&#039;slide()&#039;&#039;&#039;&#039;&#039; function to control the appearance of the slider call-out as the slider is manipulated. In this example the call-out text colour changes as the slider is moved. Sample survey here - [[Media:Dynamic_slider_call_out.lss|dynamic call-out slider survey]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Dynamic_slider_call_out.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
 &lt;br /&gt;
		// Slide function&lt;br /&gt;
		$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function( event, ui ) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), ui.value);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Initial callout states&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), $(this).val());&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Handle the callout style&lt;br /&gt;
		function handleCallout(thisRow, sliderVal) {&lt;br /&gt;
			if(sliderVal &amp;lt; 20) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D90000&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 40) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D96D00&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 60) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D9D900&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#00B22D&#039;);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sliders in Array-Numbers or Array-Dual-Scale-Numbers=&lt;br /&gt;
&lt;br /&gt;
This workaround will replace the dropdowns in &#039;&#039;&#039;&#039;&#039;array-numbers&#039;&#039;&#039;&#039;&#039; or &#039;&#039;&#039;&#039;&#039;array-dual-scale-numbers&#039;&#039;&#039;&#039;&#039; questions with sliders. The sliders will automatically have the same minimum, maximum and steps that you set in the advanced question settings.&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.06==&lt;br /&gt;
[[File:custom_sliders_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; select&#039;).each(function(i, el){&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				var id = $(el).attr(&#039;id&#039;).replace(/#/g,&#039;-&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = Number($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).val());&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).next(&#039;option&#039;).val());&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Insert a container for the slider&lt;br /&gt;
				var container = $(&#039;&amp;lt;div class=&amp;quot;customSliderWrapper&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				var slider = $(&#039;&amp;lt;div id=&amp;quot;slider-&#039;+id+&#039;&amp;quot; class=&amp;quot;customSlider&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo(container).slider({&lt;br /&gt;
					min: firstVal,&lt;br /&gt;
					max: lastVal,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					value: currentVal,&lt;br /&gt;
					step: secondVal - firstVal,&lt;br /&gt;
					slide: function( event, ui ) {&lt;br /&gt;
						$(el).val(ui.value);&lt;br /&gt;
						$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
&lt;br /&gt;
				// Insert a callout&lt;br /&gt;
				var callout = $(&#039;&amp;lt;div id=&amp;quot;callOut-&#039;+id+&#039;&amp;quot; class=&amp;quot;slider_callout slider-callout&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo($(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;)).text($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Set a value as soon as the slider handle is clicked&lt;br /&gt;
				$(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;).mousedown(function() {&lt;br /&gt;
					$(el).val(slider.slider(&#039;value&#039;));&lt;br /&gt;
					$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.customSliderWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 10px;&lt;br /&gt;
	padding-top: 1.75em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey Version 2.6x==&lt;br /&gt;
[[File:Dropdown-sliders.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.64.7 &#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
			&lt;br /&gt;
			// Identify this question&lt;br /&gt;
			var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
			thisQuestion.addClass(&#039;with-dropdown-sliders&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through all array drop-downs&lt;br /&gt;
			$(&#039;select.multiflexiselect&#039;, thisQuestion).each(function(i, el){&lt;br /&gt;
				var thisCell = $(el).closest(&#039;td&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = $(el).val();&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:eq(1)&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
&lt;br /&gt;
				// Insert an input for the slider&lt;br /&gt;
				var thisInput = $(&#039;&amp;lt;input class=&amp;quot;inserted-input&amp;quot; type=&amp;quot;text&amp;quot; /&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
				&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				thisInput.val(currentVal).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: firstVal,&lt;br /&gt;
					&#039;max&#039;: lastVal,&lt;br /&gt;
					&#039;step&#039;: secondVal - firstVal,&lt;br /&gt;
					&#039;value&#039;: Number(currentVal),&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Listener on the slider&lt;br /&gt;
				$(thisInput).on(&#039;slideStop&#039;, function () {&lt;br /&gt;
					if($(&#039;.tooltip&#039;, thisCell).is(&#039;:hidden&#039;)) {&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).show();&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).css(&#039;margin-left&#039;, &#039;-&#039;+($(&#039;.tooltip&#039;, thisCell).width()/2)+&#039;px&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(el).val($(thisInput).val());&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Hide the slider call-out if no value selected yet&lt;br /&gt;
				if(currentVal == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.tooltip&#039;, thisCell).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal {&lt;br /&gt;
    margin: 1.5em auto  1em auto;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey for version 2.6x: [[Media:Demo_Sliders_in_Array_Survey.zip|Demo_Sliders_in_Array_Survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Vertical Sliders=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, 2.00+, IE 9, Firefox 13, Chrome 19&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to apply vertical sliders to multiple-numeric questions. You can download a sample template here (with the plugin in template.js) - [[Media:default_vertical_sliders.zip|vertical slider template]] - and a sample survey here - [[Media:demo_vertical_sliders.lss|vertical slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:verticalsliders_1.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question(s). Do NOT use any of the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js. Replace &amp;quot;QQ&amp;quot; (line 5) with the question ID and adjust the options in the function call as desired. Repeat the call as many times as you need for more questions&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
	// Call the vertical slider plugin with the question ID&lt;br /&gt;
	// Edit options here as desired&lt;br /&gt;
	$(&#039;#questionQQ&#039;).lsVerticalSlider({&lt;br /&gt;
		minValue		:0,		// Minimum value (default 0)&lt;br /&gt;
		maxValue		:200,	// Maximum value (default 100)&lt;br /&gt;
		startValue		:100,	// Start value (default null)&lt;br /&gt;
		step			:10,	// Slider increments (default 1)&lt;br /&gt;
		height			:100,	// Height of slider in pixels (default 200)&lt;br /&gt;
		recordStart		:true,	// Record the start value? (default no)&lt;br /&gt;
		showMin			:true,	// Show minimum value? (default no)&lt;br /&gt;
		showMax			:true	// Show maximum value? (default no)&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
// NO EDITING REQUIRED BELOW HERE&lt;br /&gt;
// A jQuery plugin to convert multiple-numeric questions to vertical sliders&lt;br /&gt;
(function( $ ){&lt;br /&gt;
	$.fn.lsVerticalSlider = function(options) {&lt;br /&gt;
&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			minValue		:0,&lt;br /&gt;
			maxValue		:100,&lt;br /&gt;
			startValue		:&#039;&#039;,&lt;br /&gt;
			step			:1,&lt;br /&gt;
			height			:150,&lt;br /&gt;
			recordStart		:false,&lt;br /&gt;
			showMin			:false,&lt;br /&gt;
			showMax			:false&lt;br /&gt;
		}, options);&lt;br /&gt;
&lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
&lt;br /&gt;
			var $this = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Some classes for the question and subquestions&lt;br /&gt;
			$this.addClass(&#039;vertical-slider-question&#039;);&lt;br /&gt;
			$(&#039;li:[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).addClass(&#039;vertical-slider-subquestion&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through the subquestions&lt;br /&gt;
			$(&#039;li:[id&amp;lt;/div&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).each(function(i){&lt;br /&gt;
				var itemID = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) {&lt;br /&gt;
					opts.startValue = $(&#039;#answer&#039;+itemID).val();&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Insert the slider elements&lt;br /&gt;
				$(&#039;#answer&#039;+itemID).after(&lt;br /&gt;
					&#039;&amp;lt;div class=&amp;quot;vertical-slider-max-min&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-max&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-min&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div id=&amp;quot;vertical-slider-&#039;+itemID+&#039;&amp;quot; class=&amp;quot;vertical-slider&amp;quot; style=&amp;quot;height:&#039;+opts.height+&#039;px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div class=&amp;quot;vertical-slider-callout-wrapper&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-callout&amp;quot; id=&amp;quot;slider-callout-&#039;+itemID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt;&#039;&lt;br /&gt;
				);&lt;br /&gt;
&lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.vertical-slider-max&#039;, $this).text(opts.maxValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.vertical-slider-min&#039;, $this).text(opts.minValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				$(&#039;#vertical-slider-&#039;+itemID).slider({&lt;br /&gt;
					orientation: &#039;vertical&#039;,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					min: opts.minValue,&lt;br /&gt;
					max: opts.maxValue,&lt;br /&gt;
					value: opts.startValue,&lt;br /&gt;
					step: opts.step,&lt;br /&gt;
					slide: function(event, ui) {&lt;br /&gt;
						$(&#039;#answer&#039;+itemID).val(ui.value);&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).text(ui.value);&lt;br /&gt;
						setTimeout(function() {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) }).show();&lt;br /&gt;
						}, 10);&lt;br /&gt;
					},&lt;br /&gt;
					create: function(event, ui) {&lt;br /&gt;
						// Initial values and positions&lt;br /&gt;
						if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) { // Pre-existing answer&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else if(opts.recordStart) { // Record the start value (if option is set)&lt;br /&gt;
							$(&#039;#answer&#039;+itemID).val(opts.startValue);&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).hide();&lt;br /&gt;
						}&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) });&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Vertical slider styles and overrides */&lt;br /&gt;
.vertical-slider-question p.tip {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-subquestion {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 0 3em 0 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question label {&lt;br /&gt;
	display: block;&lt;br /&gt;
	padding: 0 0 0.75em 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question span.input {&lt;br /&gt;
	padding: 0.3em 0 0 0;&lt;br /&gt;
	display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question input.text {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider {&lt;br /&gt;
	float: left;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question .ui-slider-handle {&lt;br /&gt;
	top: auto;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min,&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	position: relative;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	min-width: 3em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min {&lt;br /&gt;
	margin-right: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max,&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	font-size: 0.8em;&lt;br /&gt;
	color:#666666;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max {&lt;br /&gt;
	margin-top: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	right: 0;&lt;br /&gt;
	bottom: 0;&lt;br /&gt;
	margin-bottom: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	top: auto;&lt;br /&gt;
	margin: 0 0 -0.6em 0.5em;&lt;br /&gt;
	padding: 0.1em;&lt;br /&gt;
	font-size: 0.9em;&lt;br /&gt;
	color:#000000;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	background: #F8F8FF;&lt;br /&gt;
	border: 1px solid #D2E0F2;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Range Slider=&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert a jQuery UI range slider into a multi-numeric question and automatically populate that question&#039;s inputs with the range min and max values.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039;: [[Media:Demo_Range_Slider_2.5x.zip|Sample Template and Survey.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_Range_Slider_2.5x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin handles:&lt;br /&gt;
*previous answers&lt;br /&gt;
*slider max/min&lt;br /&gt;
*range min start&lt;br /&gt;
*range max start&lt;br /&gt;
*range span min&lt;br /&gt;
*slider step&lt;br /&gt;
*record the start values&lt;br /&gt;
*show slider max and min&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;LimeSurvey 2.5x&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A multiple-numeric question with two subquestions&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create your multi-numeric question. Do NOT use any of the slider advanced settings.&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A jQuery plugin to display a range slider in LimeSurvey&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.lsRangeSlider = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:100, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:&#039;&#039;, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:&#039;&#039;, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:false, // Record the start value? (default no)&lt;br /&gt;
			showMin			:false, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:false // Show slider maximum value? (default no)&lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
 &lt;br /&gt;
			if($(this).hasClass(&#039;numeric-multi&#039;) &amp;amp;&amp;amp; $(&#039;input.text&#039;, this).length == 2) {&lt;br /&gt;
 &lt;br /&gt;
				// Define some vars	&lt;br /&gt;
				var thisQuestion = $(this);&lt;br /&gt;
				var rangeMinInput = $(&#039;input.text.form-control:eq(0)&#039;, thisQuestion); &lt;br /&gt;
				var rangeMaxInput = $(&#039;input.text.form-control:eq(1)&#039;, thisQuestion); &lt;br /&gt;
				thisQuestion.addClass(&#039;range-slider-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() != &#039;&#039;) {&lt;br /&gt;
					opts.rangeStartMin = $(rangeMinInput).val();&lt;br /&gt;
					opts.rangeStartMax = $(rangeMaxInput).val();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					if(opts.rangeStartMin == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMin = opts.sliderMin;&lt;br /&gt;
					}&lt;br /&gt;
					if(opts.rangeStartMax == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMax = opts.sliderMax;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
		&lt;br /&gt;
				// Insert the slider&lt;br /&gt;
				var insertedEls = &#039;&amp;lt;div class=&amp;quot;col-xs-12 col-sm-12 withslider&amp;quot;&amp;gt;\&lt;br /&gt;
										&amp;lt;input class=&amp;quot;inserted-slider&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;rangeSlider&amp;quot; /&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-left&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-min&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-right&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-max&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;].form-control:eq(0)&#039;, thisQuestion).closest(&#039;.subquestion-list&#039;).hide().before(insertedEls);&lt;br /&gt;
				&lt;br /&gt;
				var sliderValues = [Number(opts.rangeStartMin), Number(opts.rangeStartMax)];&lt;br /&gt;
			&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: Number(opts.sliderMin),&lt;br /&gt;
					&#039;max&#039;: Number(opts.sliderMax),&lt;br /&gt;
					&#039;step&#039;: Number(opts.step),&lt;br /&gt;
					&#039;range&#039;: true,&lt;br /&gt;
					&#039;value&#039;: sliderValues,&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider .tooltip&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
						&lt;br /&gt;
				// Listener on the range slider&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slideStart&#039;, function(event, ui) {&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slide slideStop&#039;, function(event, ui) {&lt;br /&gt;
					var thisLowerVal = Number($.trim($(this).val().split(&#039;,&#039;)[0]));&lt;br /&gt;
					var thisUpperVal = Number($.trim($(this).val().split(&#039;,&#039;)[1]));&lt;br /&gt;
					if(opts.minRangeSpan &amp;gt; 0 &amp;amp;&amp;amp; (thisUpperVal-thisLowerVal) &amp;lt; opts.minRangeSpan) {&lt;br /&gt;
						$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider(&#039;setValue&#039;, sliderValues);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(thisLowerVal);&lt;br /&gt;
						$(rangeMaxInput).val(thisUpperVal);&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
						sliderValues = [thisLowerVal, thisUpperVal];&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
 &lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.inserted-slider-min&#039;, thisQuestion).text(opts.sliderMin);&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.inserted-slider-max&#039;, thisQuestion).text(opts.sliderMax);&lt;br /&gt;
				}&lt;br /&gt;
				&lt;br /&gt;
				// Handle recordStart&lt;br /&gt;
				if(opts.recordStart) {&lt;br /&gt;
					if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[0])));&lt;br /&gt;
						$(rangeMaxInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[1])));&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider({&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:10, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:2, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:8, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:true, // Record the start value? (default no)&lt;br /&gt;
			showMin			:true, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:true // Show slider maximum value? (default no)&lt;br /&gt;
		});&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Or, to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider();&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Reverse Slider=&lt;br /&gt;
&lt;br /&gt;
{{Box|The reverse slider feature can be used in any (multiple) numerical input question type. For more details, please check the [[Question_type_-_Multiple_numerical_input#Slider|slider wiki subsection]].}}&lt;br /&gt;
&lt;br /&gt;
=Sliders With Control Buttons=&lt;br /&gt;
== Version 2.05 ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 7-10, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert &amp;quot;up&amp;quot; and &amp;quot;down&amp;quot; buttons to control sliders. You can download a sample template here - [[Media:Demo_Slider_Buttons.zip|slider with buttons template]] - and a sample survey here - [[Media:Limesurvey_survey_button_slider.lss|button slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:Button_slider.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin allows the following options:&lt;br /&gt;
*Down Text: Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
*Up Text: Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
*Scrolling: Continuous slider movement if the left mouse button is held down&lt;br /&gt;
*Scroll Interval: Interval (in milliseconds) between slider movement when button is held down (do not make this too short or it will be difficult to stop the slider accurately)&lt;br /&gt;
*Value Prefix: Prefix for call-out&lt;br /&gt;
*Value Suffix: Suffix for call-out&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A custom plugin to add control buttons to LimeSurvey sliders&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.sliderButtons = function(options) {&lt;br /&gt;
	&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
		downText: &#039;-&#039;,		// Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
		upText: &#039;+&#039;,		// Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
		scrolling: true,	// Continuous slider movement if left mouse button held down&lt;br /&gt;
		scrollInterval: 150,// Interval (in ms) between slider movement when button is held down&lt;br /&gt;
		valuePrefix: &#039;&#039;,	// Prefix for callout&lt;br /&gt;
		valueSuffix: &#039;&#039;	// Suffix for callout&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function(i) {&lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
	&lt;br /&gt;
			// Add some classes&lt;br /&gt;
			$(thisQuestion).addClass(&#039;slider-button-question&#039;);		&lt;br /&gt;
			&lt;br /&gt;
			// Insert the buttons&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;slider-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button down&amp;quot;&amp;gt;&#039;+opts.downText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button up&amp;quot;&amp;gt;&#039;+opts.upText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
														&amp;lt;/div&amp;gt;&#039;);			&lt;br /&gt;
			&lt;br /&gt;
			// Initial button states&lt;br /&gt;
			function handleButtonState(slider) {&lt;br /&gt;
				var thisRow = $(slider).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSliderVal = $(slider).slider(&#039;option&#039;, &#039;value&#039;);&lt;br /&gt;
				var thisSliderStep = $(slider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var thisSliderMin = $(slider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(slider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisRow).prop(&#039;disabled&#039;, false);&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMin) {&lt;br /&gt;
					$(&#039;button.slider-button.down&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMax) {&lt;br /&gt;
					$(&#039;button.slider-button.up&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				handleButtonState(this);	&lt;br /&gt;
				if($(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val() != &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider-callout&#039;, this).text(opts.valuePrefix+$(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val()+opts.valueSuffix);&lt;br /&gt;
				}&lt;br /&gt;
			});	&lt;br /&gt;
			&lt;br /&gt;
			// Function to handle button actions&lt;br /&gt;
			function handleButtons(thisButton) {&lt;br /&gt;
				var thisRow = $(thisButton).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSlider = $(&#039;.multinum-slider&#039;, thisRow);&lt;br /&gt;
				var thisSliderStep = $(thisSlider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var stepDecimals = 0;&lt;br /&gt;
				if(thisSliderStep.toString().indexOf(&#039;.&#039;) &amp;gt;= 0) {&lt;br /&gt;
					stepDecimals = thisSliderStep.toString().split(&#039;.&#039;)[1].length;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSliderVal = Number($(thisSlider).slider(&#039;option&#039;, &#039;value&#039;)).toFixed(stepDecimals);&lt;br /&gt;
				var thisSliderMin = $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;down&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;gt; thisSliderMin) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)-Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;up&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;lt; thisSliderMax) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)+Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				var newValue = $(thisSlider).slider(&#039;option&#039;, &#039;value&#039;).toFixed(stepDecimals).replace(/\./, LSvar.sLEMradix);&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(newValue).triggerHandler(&#039;keyup&#039;);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisSlider).text(opts.valuePrefix+newValue+opts.valueSuffix);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Scrolling&lt;br /&gt;
			if(opts.scrolling == true) {&lt;br /&gt;
					&lt;br /&gt;
				var sliderTimeout;&lt;br /&gt;
				var clicker = $(&#039;button.slider-button&#039;, thisQuestion);&lt;br /&gt;
				var count = 0;&lt;br /&gt;
&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mousedown(function(){&lt;br /&gt;
					var thisButton = $(this);&lt;br /&gt;
					sliderTimeout = setInterval(function(){&lt;br /&gt;
						handleButtons(thisButton);&lt;br /&gt;
					}, opts.scrollInterval);				&lt;br /&gt;
					return false;&lt;br /&gt;
				});				&lt;br /&gt;
				&lt;br /&gt;
				$(document).mouseup(function(){&lt;br /&gt;
					clearInterval(sliderTimeout);&lt;br /&gt;
					return false;&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mouseout(function(){&lt;br /&gt;
					handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Listener on the buttons&lt;br /&gt;
			$(&#039;button.slider-button&#039;, thisQuestion).click(function(e) {&lt;br /&gt;
				handleButtons(this)	;		&lt;br /&gt;
				handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on sliders&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function( event, ui ) {&lt;br /&gt;
				handleButtonState(this);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on reset buttons&lt;br /&gt;
			$(&#039;.slider-reset&#039;, thisQuestion).on( &amp;quot;click&amp;quot;, function( event, ui ) {&lt;br /&gt;
				var thisReset = $(this);&lt;br /&gt;
				setTimeout(function() {&lt;br /&gt;
					handleButtonState($(thisReset).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				}, 150);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template but easily modified for others):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.slider-button-question label.slider-label {&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    padding: 40px 1em 0 0;&lt;br /&gt;
    *padding: 25px 1em 0 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question div.multinum-slider {&lt;br /&gt;
	margin-top: 45px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .ui-slider-horizontal .ui-slider-handle {&lt;br /&gt;
	width: 18px;&lt;br /&gt;
    margin-left: -9px;&lt;br /&gt;
    top: -4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider_callout {&lt;br /&gt;
    margin-left: -41px;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
    width: 100px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 40px 0 0 25px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button {&lt;br /&gt;
	padding: 0 10px;&lt;br /&gt;
	margin: 0 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button:disabled {&lt;br /&gt;
	opacity:0.65;&lt;br /&gt;
	filter:alpha(opacity=65);&lt;br /&gt;
	cursor: default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-reset {&lt;br /&gt;
	margin-top: 42px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons({&lt;br /&gt;
			downText: &#039;Down&#039;, // Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
			upText: &#039;Up&#039;, // Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
			scrolling: true, // Continuous slider movement if left mouse button held down&lt;br /&gt;
			scrollInterval: 250, // Interval (in ms) between slider movement when button is held down&lt;br /&gt;
			valueSuffix: &amp;quot;%&amp;quot;	// Suffix for callout&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Or, simply to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons();&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Slider Control Buttons for LimeSurvey 3.x can be found here - https://github.com/tpartner/LimeSurvey-Slider-Controls-3x&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176531</id>
		<title>Workarounds: Question design, layout and templating</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176531"/>
		<updated>2023-05-11T17:29:36Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Star Rating System Using Numeric Input Question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This section more or less deals with styling your survey, adjusting the layout and setting up special question types. You can find &#039;&#039;&#039;similar information&#039;&#039;&#039; at these pages:&lt;br /&gt;
* [[The template editor]]&lt;br /&gt;
* [[Workarounds: Manipulating a survey at runtime using Javascript]]&lt;br /&gt;
* [[Workarounds: Survey behaviour]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves. &amp;lt;span style=&#039;color:#EE0000&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Different progress indicator=&lt;br /&gt;
&lt;br /&gt;
==Version 1.87 and later:==&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will find the progress value and insert it into the element following the progress bar.&lt;br /&gt;
&lt;br /&gt;
It should be pointed out that I had to introduce a delay in firing the function because the progress value is not calculated until after template.js is called. The delay is set at 1/10 of a second but you may be able to reduce that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // Display progress value&lt;br /&gt;
&lt;br /&gt;
   function setProgValue() {&lt;br /&gt;
&lt;br /&gt;
       var progress = $(&#039;#progressbar&#039;).attr(&#039;aria-valuenow&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).text(progress+&#039;%&#039;).show();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
       setTimeout(&#039;setProgValue()&#039;,100);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to hide the &amp;quot;0%&amp;quot; before the progress bar, add the following to the end of template.css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
#progress-pre {&lt;br /&gt;
&lt;br /&gt;
   display: none;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Delete unwanted gaps in question title=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When copying data (questions, answers, ...) from MS Word or other applications into the editor there might occur some gaps in the question title.&lt;br /&gt;
&lt;br /&gt;
There are two solutions to this:&lt;br /&gt;
# Use popup mode and manually delete unwanting extra html tags (requires html knowledge).&lt;br /&gt;
# Disable paste word feature: Tweak your limesurvey-config.js file in limesurvey/admin/scripts/fckeditor.26 and set the following option to true:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;FCKConfig.ForcePasteAsPlainText = true ;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that clear you browser cache and try again.&lt;br /&gt;
&lt;br /&gt;
=How to change the &amp;lt;font-size&amp;gt; tags using CSS=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This workaround was deleted because it is outdated. Such changes can be done by [[The template editor#Styling questions with CSS|adjusting template.css]] of your template.&lt;br /&gt;
&lt;br /&gt;
=Question type variation: Scale with bars (one and two sided)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some methodogical issues to think about: Very often a common scale as 1 to 5 or -2 to +2 fits all needs, as the shown subject is clearly defined as positive or negative. As soon as you would reduce the influence from the question and scale on the respondent, you will need something neutral to determine tendences, emphases and so on.&lt;br /&gt;
&lt;br /&gt;
So I put up a new variation of the one and two sided array question:&lt;br /&gt;
&lt;br /&gt;
ttp://www.limesurvey.org/images/fbfiles/images/example_bar_scale.jpg&lt;br /&gt;
&lt;br /&gt;
In my example the left side reads &amp;quot;strategical planning&amp;quot; and the right side &amp;quot;operative business&amp;quot;. None of these are purely negative or positive, so the bars only show in which direction the balancing point moves.&lt;br /&gt;
&lt;br /&gt;
To realize a question as shown above just do as follows:&lt;br /&gt;
&lt;br /&gt;
Set up as many bars as you will need (in my example there are four different bars in total) with a graphic program like PAINT .NET, GIMP or similar ones (yes, you may also use commercial software like Photoshop). To prevent the bars from looking twitchy, designate the size in advance. I did one bar 60x15 px, one 45x15px, one 30x15px and at last 15x15px. Save them as PNG, JPG or GIF.&lt;br /&gt;
# Create a new label set within Lime. Call it whatever you like.&lt;br /&gt;
# Enter a code number at first, then press the pencil symbol to enter the editor.&lt;br /&gt;
#Press the &amp;quot;Insert / edit image&amp;quot; button and upload the bar you want to insert with the FCK upload tool. Then choose the uploaded picture, save and leave the FCK editor.&lt;br /&gt;
#The row in the lable editor now shows an &amp;lt;img&amp;gt;-tag which refers to your bar picture.&lt;br /&gt;
#Repeat the above described steps as often as needed to build up your bar scale.&lt;br /&gt;
&lt;br /&gt;
=Doing a Likert Scale=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A Likert Scale is a special type of the Semantic Differential question where several item shall be rated on different scales, each marked at the beginning and at the end with opposite statements. &lt;br /&gt;
&lt;br /&gt;
To do this in LimeSurvey just follow these steps:&lt;br /&gt;
#Create a label set with values from 0 to 7 (for the classic Likert Scale - feel free to choose other ranges).&lt;br /&gt;
#Create a new question and choose Array (Flexible Labels) as question type.&lt;br /&gt;
#Assign the Likert Scale label set to this question.&lt;br /&gt;
#Enter your answers as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;DIV style=&amp;quot;white-space: nowrap;&amp;quot;&amp;gt;ITEM statement1|statement2&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The white-space style is to avoid line breaks which would ruin the whole scale. feel free to insert non-breakable spaces between the ITEM and statement1 to define the margin between these to strings.&lt;br /&gt;
&lt;br /&gt;
=Alternate background colour of questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To alternate the background colour of questions, open the &#039;&#039;template.css&#039;&#039; of your template with the Template Editor or a text editor and modify the &#039;&#039;Question styles&#039;&#039; section to include the following style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
div#question2 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question4 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question6 td.questiontext {&lt;br /&gt;
&lt;br /&gt;
   background-color: #E0EBF8;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to apply the style to all of the questions you would like modified using their question IDs (&#039;&#039;question2, question4, question6&#039;&#039; in this case). Question IDs are displayed when creating or editing questions - see below:&lt;br /&gt;
&lt;br /&gt;
[[File:qid_1_493x173.gif]]&lt;br /&gt;
&lt;br /&gt;
Here the question ID is #question80 .&lt;br /&gt;
&lt;br /&gt;
=Embedding audio in questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191), IE 7, FireFox 3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Audio clips can be embedded in most question text or answer text. In this example, using the default template, I&#039;ve embedded clips into the answers of an &#039;&#039;&#039;&#039;&#039;Array (Yes/No/Uncertain)&#039;&#039;&#039;&#039;&#039; question to ask respondents how they feel about some sounds. The resulting question will look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x202.gif]]&lt;br /&gt;
&lt;br /&gt;
It&#039;s accomplished by placing the following code in each of the answers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;embed height=&amp;quot;20&amp;quot; width=&amp;quot;128&amp;quot; autostart=&amp;quot;false&amp;quot; controls=&amp;quot;console&amp;quot;&lt;br /&gt;
&lt;br /&gt;
loop=&amp;quot;true&amp;quot; volume=&amp;quot;50&amp;quot; src=&amp;quot;{TEMPLATEURL}audio_1.mp3&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some notes about the code:&lt;br /&gt;
*The &#039;&#039;audio_1.mp3&#039;&#039; part will be different for each answer (it&#039;s the audio file name).&lt;br /&gt;
*In this case the audio files are residing in the template folder being used for this survey (that&#039;s where &#039;&#039;{TEMPLATEURL}&#039;&#039; points to) but they can be placed anywhere if you use an absolute URL in the &#039;&#039;src&#039;&#039; parameter - something like &#039;&#039;src=&amp;quot;http://mysite.com/audio/audio_1.mp3&amp;quot;&#039;&#039;&lt;br /&gt;
*If the audio file doesn&#039;t exist where the &#039;&#039;src&#039;&#039; parameter indicates, the player will not appear.&lt;br /&gt;
*You&#039;ll need to insert the code into the answers using the source screen - click on &amp;quot;Edit answers&amp;quot;, click the pencil beside the text box, click &amp;quot;Source&amp;quot; in the pop-up, enter the code and save it with the little diskette icon.&lt;br /&gt;
*You may need to turn off the XSS filter - see the documentation for [http://docs.limesurvey.org/tiki-index.php?page=Global+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Security Global settings].&lt;br /&gt;
&lt;br /&gt;
Although the above example places the audio in the answer text of the question, the same principles can be used to place it in the question text itself. Something like this perhaps.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x154.gif]]&lt;br /&gt;
&lt;br /&gt;
=Hiding inputs of a &amp;quot;Multiple options with comments&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
There may be times when you want to hide some of the input boxes of a &#039;&#039;&#039;&#039;&#039;Multiple choice question type with comments&#039;&#039;&#039;&#039;&#039; question as in the image below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:hidden_inputs_541x168.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This can be accomplished with CSS (see [[The template editor#Styling questions with CSS|Styling questions in LimeSurvey 1.8]]). For each input that you want to hide, add the following style to your template.css file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
#answer11111X22X33Acomment {&lt;br /&gt;
   display: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where 11111 is your survey ID, 22 is your group ID, 33 is your question ID and A is the answer code.&lt;br /&gt;
&lt;br /&gt;
Note that you will still see columns for the hidden inputs in your data but they will be empty.&lt;br /&gt;
&lt;br /&gt;
=Multiple question types in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90 - 1.92+, IE 7/8/9, Firefox 13, Safari 5, Chrome 10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Media:limesurvey_survey_62584.lss|Download the sample survey]]&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present multiple question types in what appears to be an array - as depicted in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=62584&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here] (download the sample survey - [[Media:limesurvey_survey_62584.lss|limesurvey_survey_62584.lss]]). This example uses the default template but should be adaptable to any template using divisions for question containers.&lt;br /&gt;
&lt;br /&gt;
[[File:inline_questions_700x228.png]]&lt;br /&gt;
&lt;br /&gt;
Basically what we do is take groups of questions (5 in this case), wrap them in a division and make them line up nicely horizontally and vertically. The width of the survey is also fixed to prevent wrapping issues. We do this with a JavaScript/jQuery function that inserts the necessary wrappers and then modifies styles so everything behaves properly. The top row is 5 boilerplate questions with the &amp;quot;column headers&amp;quot; as question text (the first just has a blank space). The following rows are a boilerplate with the &amp;quot;row headers&amp;quot; followed by 4 assorted questions.&lt;br /&gt;
&lt;br /&gt;
It should be noted that using conditions on these questions may result in unexpected behavior. If a question is hidden by conditions, the question(s) to the right of it will move over to take its place.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Create your questions keeping in mind how they will lay out when grouped into rows (in this example - boilerplate, yes/no, short text, numeric, dropdown, and repeat).&lt;br /&gt;
#In the source of the first boilerplate question add the function below (see [http://manual.limesurvey.org/wiki/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F How to use script]).&lt;br /&gt;
#Modify the number of rows, number of columns and the start placement in the function call (line 6) as required (the example uses 4 rows and 5 columns and the &amp;quot;array&amp;quot; starts with the third question on the page).&lt;br /&gt;
&lt;br /&gt;
The code may look intimidating at first but it&#039;s actually fairly simple. I&#039;ve laid it out as sequentially as possible and purposely used few shortcuts and many comments to make it easier to follow.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
*If you use question types other than boilerplate, short text, list dropdown, numeric or yes-no, you&#039;ll need to add to the last section of code, where it hides the question text and formats the inputs for display this way.&lt;br /&gt;
*Any extra questions on the page should follow this grid of questions, not precede them.&lt;br /&gt;
* If you use boilerplate as question type you should add after:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
the following 2 lines&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
//repair boilerplate questioncells&lt;br /&gt;
$(&#039;div.boilerplate td.questiontext&#039;).parent().show();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Javascript code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the &amp;quot;sideBySide&amp;quot; function with number of rows, columns and start position&lt;br /&gt;
		sideBySide(4, 5, 3);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function sideBySide(rows, columns, startQuestion) {&lt;br /&gt;
&lt;br /&gt;
		/*********** Display multiple questions side by side ***********/&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;div.qRow1&#039;).length == 0) {&lt;br /&gt;
&lt;br /&gt;
			var rowNum = 0;&lt;br /&gt;
			var colNum = 1;&lt;br /&gt;
			var rowList = new Array();&lt;br /&gt;
&lt;br /&gt;
			//////// Add question classes for later use ////////&lt;br /&gt;
&lt;br /&gt;
			// Loop through all questions and add row and column specific classes&lt;br /&gt;
			$(&#039;div[id^=&amp;quot;question&amp;quot;]&#039;).each(function(i) {&lt;br /&gt;
				if(i &amp;gt;= (startQuestion-1) &amp;amp;&amp;amp; rowNum &amp;lt; rows) { // This IF condition only needed if there are questions before or following the &amp;quot;inline&amp;quot; questions&lt;br /&gt;
					$(this).addClass(&#039;qRow&#039;+rowNum+&#039;&#039;).addClass(&#039;qCol&#039;+colNum+&#039;&#039;).addClass(&#039;inlineQuestion&#039;);&lt;br /&gt;
					if(rowNum == 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;columnLabel&#039;);&lt;br /&gt;
					}  &lt;br /&gt;
					if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum == 1) {&lt;br /&gt;
						$(this).addClass(&#039;rowLabel&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;questionCell&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					if(colNum == columns) {&lt;br /&gt;
						rowList.push(&#039;qRow&#039;+rowNum+&#039;&#039;);&lt;br /&gt;
						rowNum++;&lt;br /&gt;
						colNum = 1;&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						colNum++;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).addClass(&#039;normalQuestion&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Survey layout manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Fix the width of the survey&lt;br /&gt;
			$(&#039;table.outerframe&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;900px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Wrap each &amp;quot;row&amp;quot; in a wrapper div&lt;br /&gt;
			$(rowList).each(function(i) {&lt;br /&gt;
				$(&#039;.&#039;+this+&#039;&#039;).wrapAll(&#039;&amp;lt;div id=&amp;quot;inlineWrapper&#039;+i+&#039;&amp;quot; class=&amp;quot;inlineRow&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Style the wrapper divs&lt;br /&gt;
			$(&#039;.inlineRow&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;850px&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0 auto 0 auto&#039;,&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.inlineRow:first&#039; ).css({&lt;br /&gt;
				&#039;margin-top&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get all the questions to sit politely side by side&lt;br /&gt;
			$( &#039;.inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;float&#039;: &#039;left&#039;,&lt;br /&gt;
				&#039;height&#039;:&#039;41px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;-8px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;.inlineQuestion .questionhelp&#039; ).hide();&lt;br /&gt;
			$( &#039;.inlineQuestion .survey-question-help&#039; ).parent().hide();&lt;br /&gt;
		   &lt;br /&gt;
			// A little space under the last row&lt;br /&gt;
			$( &#039;.inlineRow:last .inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Any questions not displayed inline (this is only needed if there are questions following the &amp;quot;inline&amp;quot; questions)&lt;br /&gt;
			$( &#039;.normalQuestion&#039; ).css({&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Column manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Set the column widths - can be set individually if necessary&lt;br /&gt;
			// Must add up to less than 100%&lt;br /&gt;
			$( &#039;.qCol1&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;12%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.qCol2, .qCol3, .qCol4, .qCol5&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;22%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Question manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Hide the answer element in boilerplate questions&lt;br /&gt;
			$( &#039;div.boilerplate td.answer&#039; ).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
			$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Push the question tables to 100%&lt;br /&gt;
			$( &#039;div.inlineRow table&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;100%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get everything to line up nicely vertically&lt;br /&gt;
			$( &#039;.inlineQuestion td.questiontext, .inlineQuestion td.answer p&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Adjust cell heights so everything lines up nicely horizontally&lt;br /&gt;
			$( &#039;.inlineQuestion td.answer, .inlineQuestion td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;35px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;0.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;#inlineWrapper0 .inlineQuestion&#039; ).css({ &#039;height&#039;:&#039;50px&#039; });&lt;br /&gt;
			$( &#039;#inlineWrapper0 td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;50px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Yes-no question styles&lt;br /&gt;
			$( &#039;div.yes-no ul&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;,&lt;br /&gt;
				&#039;font-size&#039;: &#039;90%&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0&#039;,&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;5px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no li&#039; ).css({&lt;br /&gt;
				&#039;padding-right&#039;: &#039;1.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no td.answer&#039; ).css({&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Short-text question styles&lt;br /&gt;
			$( &#039;div.text-short input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Numeric question styles&lt;br /&gt;
			$( &#039;div.numeric input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.numeric p.tip&#039; ).css({&lt;br /&gt;
				&#039;display&#039;: &#039;none&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get rid of the margins around select boxes&lt;br /&gt;
			$( &#039;p.question&#039; ).css({ &#039;margin&#039;:&#039;0&#039; });&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Star Rating System=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://www.fyneworks.com/jquery/star-rating/ jQuery Star Rating Plugin] to display a series of stars that are used to generate a rating value. This value is then passed to either a hidden numeric input question or a hidden list radio question. Both methods are outlined below - use one or both depending on whether you want to use [Assessments|assessments].&lt;br /&gt;
&lt;br /&gt;
The plugin uses a series of radio inputs to generate the stars (more about these below). It allows the use of whole or partial stars as shown in the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x324.png]]&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using Numeric Input Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like your rating data to be collected as a numeric value and don&#039;t want to use [[Assessments|LimeSurvey assessments]] - it&#039;s a little easier to implement.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#[http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
##jquery.MetaData.js&lt;br /&gt;
##jquery.rating.css&lt;br /&gt;
##jquery.rating.js&lt;br /&gt;
##delete.gif&lt;br /&gt;
##star.gif&lt;br /&gt;
#In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a numeric input question and then in the source of the question add as many radio inputs as star segments. For example, if you would like 5 stars, each with half-segments, you would need 10 radio inputs and that would give rating values from 1-10.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q1 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;6&amp;quot; value=&amp;quot;6&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;7&amp;quot; value=&amp;quot;7&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;8&amp;quot; value=&amp;quot;8&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;9&amp;quot; value=&amp;quot;9&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;10&amp;quot; value=&amp;quot;10&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. A note on split stars. The stars in the above example are split in half by the &#039;&#039;{ split:2 }&#039;&#039; metadata. So if you don&#039;t want split stars, your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
7. Finally, in the source of the question add the following function after your inputs. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the numeric input and pass the rating values into it as they are changed. If the rating is canceled the numeric input is nullified. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingNumeric(11111, 22, 1); handleRatingNumeric(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingNumeric (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the numeric input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val();&lt;br /&gt;
&lt;br /&gt;
   if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the numeric question&lt;br /&gt;
&lt;br /&gt;
handleRatingNumeric (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using List (Radio) Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like to use [[Assessments|assessments]]. There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en here] (second question).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
&lt;br /&gt;
2. Set up the template to use custom onload functions. (See the [[Workarounds: Manipulating a survey at runtime using Javascript#Custom onload function|workaround here]])&lt;br /&gt;
&lt;br /&gt;
3. [http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
*jquery.MetaData.js&lt;br /&gt;
*jquery.rating.css&lt;br /&gt;
*jquery.rating.js&lt;br /&gt;
*delete.gif&lt;br /&gt;
*star.gif&lt;br /&gt;
&lt;br /&gt;
4. In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a list (radio) question with the same amount of sequentially numbered answers as star ratings. For example, if you want 5 whole-stars, you would create 5 answers, as in the image below, and this would give you ratings from 1-5. Note that the &amp;quot;Codes&amp;quot; and &amp;quot;Answers&amp;quot; must be sequential numbers.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x156_v2.png]]&lt;br /&gt;
&lt;br /&gt;
6. In the list (radio) question, set the [[Advanced question settings|hide_tip]] question attribute to 1&lt;br /&gt;
&lt;br /&gt;
7. In the source of the question add as many radio inputs as star segments. So 5 whole-stars (as in the demo Q2), would need 5 radio inputs.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q2 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. A note on split stars. The stars in the above example are whole-stars. If you want them split you need to add metadata to the class - something like &#039;&#039;{ split:2 }&#039;&#039;. So if you want half-stars your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
9. Finally, in the source of the question add the following function after your inputs. (See [http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure;=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ How to use script here])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the question radio buttons and toggle them as the rating values are changed. If the rating is canceled all question inputs are unchecked. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingRadio(11111, 22, 1); handleRatingRadio(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Onload code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingRadio (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the radio input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#question&#039; + qID + &#039; input.radio[checked=true]&#039;).attr(&#039;value&#039;);&lt;br /&gt;
&lt;br /&gt;
   //if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
   if ( rating ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio[value=&#039; + rating + &#039;]&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the radio question&lt;br /&gt;
&lt;br /&gt;
handleRatingRadio (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable column widths in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define all column widths of an array question - as shown in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here]. This example uses the default template shipped with 7557 but should be adaptable to any template.&lt;br /&gt;
&lt;br /&gt;
[[File:array_widths_701x226.gif]]&lt;br /&gt;
&lt;br /&gt;
We use a function to remove all of the widths imposed by the core code and then insert our own.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects documentation here]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Replace all instances of QQ with the question ID.&lt;br /&gt;
#In the third section of code, adjust the widths and add/remove columns as necessary. This example is for an array with a question text column followed by 3 answer columns as shown above.&lt;br /&gt;
#In the final section adjust the question text alignment to your liking&lt;br /&gt;
&lt;br /&gt;
Onload code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // Get rid of all the widths that the API imposes&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question col&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question thead td&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define a width for the question table so we can do so for its children&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Keep this to 95% or less so IE will behave&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question&#039; ).attr(&#039;width&#039;, &#039;95%&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define the column widths&lt;br /&gt;
&lt;br /&gt;
   // Add or remove columns and adjust widths as necessary but widths should add up to 100%&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Columns must be sequentially numbered starting at 0 - eg, td:eq(0), td:eq(1), td:eq(2).....&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th:eq(0)&#039; ).css({ &#039;width&#039;:&#039;10%&#039; }); // Answer text column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(0)&#039; ).css({ &#039;width&#039;:&#039;50%&#039; }); // First answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(1)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Second answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(2)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Third answer column&lt;br /&gt;
&lt;br /&gt;
   // Push the text input widths to 95% of their parent containers&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question input[type=&amp;quot;text&amp;quot;]&#039; ).css({ &#039;width&#039;:&#039;95%&#039; });&lt;br /&gt;
&lt;br /&gt;
   // Align the answer text - feel free to experiment&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th&#039; ).css({&#039;text-align&#039;:&#039;center&#039;});&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use images for radio buttons and checkboxes=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.92/2.0, using IE 9, FireFox 13, Chrome 16, Safari 5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses an adaptation of the jQuery imagetick.js plugin to replace the default radio buttons and checkboxes with images as pictured below:&lt;br /&gt;
&lt;br /&gt;
[[File:images.png]] &lt;br /&gt;
&lt;br /&gt;
This adaptation will work in the following question types:&lt;br /&gt;
*Array&lt;br /&gt;
*Array by column&lt;br /&gt;
*Array dual scale&lt;br /&gt;
*Array (5 point choice)&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
*Array (Increase-Same-Decrease)&lt;br /&gt;
*Array (Yes-No-Uncertain)&lt;br /&gt;
*Gender&lt;br /&gt;
*Yes-No&lt;br /&gt;
*Multiple choice&lt;br /&gt;
*Multiple choice with comments&lt;br /&gt;
*5 point choice&lt;br /&gt;
*List (Radio)&lt;br /&gt;
*List with comment&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey 2.0 and later implementation==&lt;br /&gt;
&lt;br /&gt;
Follow the instructions above with these changes:&lt;br /&gt;
#Download [[Media:Imagetick_lime_v2.1.zip|this modified version of the plugin for 2.0 and up]] instead of the one mentioned above and add all contained files to your template directory.&lt;br /&gt;
#Add these lines to the &amp;lt;head&amp;gt; element in your startpage.pstpl instead of the one above:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}imagetick_lime_2.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}imagetick_lime_2.css&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thanks to Jordan Boesch for the original plugin.&lt;br /&gt;
&lt;br /&gt;
=Changing the position and layout of an individual question using &amp;quot;question code&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (6536)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use this very flexible workaround you first have to apply a minor change to the question.pstpl of the used template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
needs to be changed to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this change won&#039;t change anything in the layout and can be left in the template even if you don&#039;t need this workaround. It&#039;s just a means to have a handle to actually change individual questions.&lt;br /&gt;
&lt;br /&gt;
You can then use a code such as the following in the question text to make question specific format changes. &amp;quot;SAMPLE&amp;quot; needs to be replaced with the concerning question code and javascript has to be allowed ([[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|older versions of limesurvey]], under global settings for newer versions).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.borderTop= &amp;quot;0px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginTop= &amp;quot;-62px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginLeft= &amp;quot;30px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sample code will hide the border at the top of the question, will move the whole question up by 62px and to the right by 30px. Using this workaround you can change a whole a lot of things concerning format and positions of a specific question without changing all the questions. A (German) list of all the allowed options can be found [http://de.selfhtml.org/javascript/objekte/style.htm#style_eigenschaften here].&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
==Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Assign a label set to the question - these will be the labels in the center column.&lt;br /&gt;
#Set the second parameter of the function call to true for randomized rows.&lt;br /&gt;
#Adjust the styles in lines 21-24 as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The script moves the question columns into the MaxDiff configuration and disables the opposing radio element when a selection is made.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
	&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, false);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function maxDiff(qID, randomize) {&lt;br /&gt;
		&lt;br /&gt;
		// Random number between 1 and 2&lt;br /&gt;
		// Math.floor(Math.random() * (max - min + 1)) + min;&lt;br /&gt;
		var randomNum = Math.floor(Math.random() * ((2-1)+1) + 1);&lt;br /&gt;
&lt;br /&gt;
		// Move the columns&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col:eq(1)&#039;).prependTo(&#039;colgroup.col-responses&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list thead tr:eq(0) th:eq(0)&#039;).prependTo(&#039;#question&#039;+qID+&#039; table.question thead tr:eq(0)&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Random rows&lt;br /&gt;
		if(randomize) {&lt;br /&gt;
			var rowsArr = [];&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
				$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
				rowsArr.push(i);&lt;br /&gt;
			});&lt;br /&gt;
			shuffleArray(rowsArr);&lt;br /&gt;
			$(rowsArr).each(function(i){&lt;br /&gt;
				$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody&#039;).append($(&#039;#question&#039;+qID+&#039; tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Style stuff&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col.odd&#039;).css({ &#039;background-color&#039;:&#039;transparent&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody th&#039;).css({ &#039;text-align&#039;:&#039;center&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:even td, #question&#039;+qID+&#039; table.question tbody tr:even th&#039;).css({ &#039;background-color&#039;:&#039;#F1F1F1&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:odd td, #question&#039;+qID+&#039; table.question tbody tr:odd th&#039;).css({ &#039;background-color&#039;:&#039;#FCFCFC&#039; });&lt;br /&gt;
&lt;br /&gt;
		// Prevent clicking twice in the same row&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input.radio&#039;).on(&#039;click&#039;, function () {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio&#039;).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio:checked&#039;).each(function(i) {&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				$(&#039;input.radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function shuffleArray(array) {&lt;br /&gt;
		for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
			var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
			var temp = array[i];&lt;br /&gt;
			array[i] = array[j];&lt;br /&gt;
			array[j] = temp;&lt;br /&gt;
		}&lt;br /&gt;
		return array;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Versions 2.5 and 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:MaxDiff_2.5.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Template.zip|Demo template]]&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Survey.zip|Demo survey]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Add 2 subquestions to the array - these will be the left and right columns.&lt;br /&gt;
#Add answers to the array - these will be the rows.&lt;br /&gt;
#Create a copy the default template.&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.js&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function maxDiff(qID, randomize) {&lt;br /&gt;
 &lt;br /&gt;
	// Identify some elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisTable = $(&#039;table.subquestion-list:eq(0)&#039;, thisQuestion);&lt;br /&gt;
 &lt;br /&gt;
	// Assign a new question class&lt;br /&gt;
	$(thisQuestion).addClass(&#039;max-diff-array&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Move the columns&lt;br /&gt;
	$(&#039;thead tr:eq(0)&#039;, thisTable).prepend($(&#039;thead tr:eq(0) th:eq(1)&#039;, thisTable));&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
		$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Random rows&lt;br /&gt;
	if(randomize) {&lt;br /&gt;
		var rowsArr = [];&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
			$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
			rowsArr.push(i);&lt;br /&gt;
		});&lt;br /&gt;
		shuffleArray(rowsArr);&lt;br /&gt;
		$(rowsArr).each(function(i){&lt;br /&gt;
			$(&#039;tbody&#039;, thisTable).append($(&#039;tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;, thisTable));&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	// Prevent clicking twice in the same row&lt;br /&gt;
	$(&#039;input:radio&#039;, thisQuestion).on(&#039;click&#039;, function () {&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;input:radio&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		$(&#039;input:radio:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr.answers-list&#039;);&lt;br /&gt;
			$(&#039;input:radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		});&lt;br /&gt;
	});	&lt;br /&gt;
 &lt;br /&gt;
	// Fix up the row classes&lt;br /&gt;
	var rowClass = 1;&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i) {&lt;br /&gt;
		$(this).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.css&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.max-diff-array th.answertext { &lt;br /&gt;
	text-align: center;&lt;br /&gt;
	border-right: 3px solid #FFFFFF;&lt;br /&gt;
	border-left: 3px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
/* Override the responsive &amp;quot;no-more-tables&amp;quot; stuff */&lt;br /&gt;
@media only screen and (max-width: 801px) {&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables table {&lt;br /&gt;
		display: table;&lt;br /&gt;
		border-collapse: inherit;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables thead, &lt;br /&gt;
	.max-diff-array .no-more-tables tbody {&lt;br /&gt;
		display: table-row-group;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables tr {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		position: relative;&lt;br /&gt;
		top: auto;&lt;br /&gt;
		display: table-row;&lt;br /&gt;
		border: 0 none;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables th, &lt;br /&gt;
	.max-diff-array .no-more-tables td {&lt;br /&gt;
		display: table-cell;&lt;br /&gt;
		text-align: center !important;&lt;br /&gt;
		color: #2c3e50;&lt;br /&gt;
		font-size: 15px;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array th.answertext { &lt;br /&gt;
		border-right: 3px solid #FFFFFF;&lt;br /&gt;
		border-left: 3px solid #FFFFFF;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .answer-item label span {&lt;br /&gt;
		display: none !important;&lt;br /&gt;
	}	&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add a script like this to the question source of the Array (flexible labels) question:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	   &lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, true);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Load SVG Code From Drawing Tool=&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to load a drawing tool and store the results in a huge-text question. The details are outlined in the [[Workarounds: Manipulating a survey at runtime using Javascript#Load SVG Code From Drawing Tool|JavaScript section of the workarounds]].&lt;br /&gt;
&lt;br /&gt;
=Minimum or Maximum Date in Datepicker=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note: From version 2.05 beta6, you MUST set the minimum and maximum date for the date picker directly in the advanced question attributes of the date/time question. This workaround will seize to work.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can set the minimum or maximum selectible date in a datepicker as follows&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]] and add the following to the source of the date question text or help. Replace &amp;quot;QQ&amp;quot; with the date question ID.&lt;br /&gt;
&lt;br /&gt;
For a minimum date of April 15, 2010:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date(2010, 4-1, 15) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a minimum date of the current date (today):&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date() );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a maximum date of May 10, 2015:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date(2015, 5-1, 10) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More details here - http://jqueryui.com/demos/datepicker/#option-minDate&lt;br /&gt;
&lt;br /&gt;
=Evaluative Space Grid (ESG)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 &amp;amp; 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The evaluative space grid (ESG) is a two-dimensional grid that provides a single-item measure of positivity and negativity (Larsen et al, 2009). See [http://leeds-faculty.colorado.edu/mcgrawp/pdf/larsen.norris.mcgraw.hawkley.cacioppo.2009.pdf page 4 of this PDF].&lt;br /&gt;
&lt;br /&gt;
This can be accomplished using a multiple-numeric question, some simple HTML and a little JavaScript.&lt;br /&gt;
&lt;br /&gt;
A table can be shown in the question. When a respondent clicks a grid cell in the table JavaScript loads the coordinates of the cell into the multiple-numeric question inputs.&lt;br /&gt;
&lt;br /&gt;
[[File:Space_grid_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create a Multiple Numeric question with two subquestions labelled &amp;quot;X&amp;quot; and &amp;quot;Y&amp;quot;.&lt;br /&gt;
#Add the following HTML to the source of the question to create the table:&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;spaceGrid&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td rowspan=&amp;quot;5&amp;quot; class=&amp;quot;yAxisLabel&amp;quot;&amp;gt;How NEGATIVE&amp;lt;br&amp;gt;&lt;br /&gt;
			do you feel about&amp;lt;br&amp;gt;&lt;br /&gt;
		the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td colspan=&amp;quot;5&amp;quot; class=&amp;quot;xAxisLabel&amp;quot;&amp;gt;How POSITIVE do you feel about the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following styles to the end of your template.css file:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.spaceGrid {&lt;br /&gt;
	width: auto;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.spaceGrid td {&lt;br /&gt;
	padding: 0 3px;&lt;br /&gt;
	text-align: center !important;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xAxisLabel {&lt;br /&gt;
	padding-top: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yAxisLabel {&lt;br /&gt;
	padding-right: 10px;&lt;br /&gt;
	width: 125px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xLabel {&lt;br /&gt;
	height: 20px;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yLabel {&lt;br /&gt;
	text-align: right !important;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.gridCell {&lt;br /&gt;
	width: 70px;&lt;br /&gt;
	height: 70px;&lt;br /&gt;
	border: 1px solid #666666;&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.checkedCell {&lt;br /&gt;
	background-color: #66FF00;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of your template.js file:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;	&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
	$(&#039;.spaceGrid&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
		// Define some vars&lt;br /&gt;
		var thisQuestion = $(this).closest(&#039;.numeric-multi&#039;);&lt;br /&gt;
		var thisTable = $(this).closest(&#039;table.spaceGrid&#039;);&lt;br /&gt;
		var numGridCell = $(&#039;.gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numCols = $(&#039;tr:eq(0) .gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numRows = numGridCell/numCols;&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers list&lt;br /&gt;
		$(&#039;.subquestion-list, .questions-list&#039;, thisQuestion).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Initial state&lt;br /&gt;
		var xCoord = $(&#039;input.text:eq(0)&#039;, thisQuestion).val() - 1;&lt;br /&gt;
		var yCoord = numRows - $(&#039;input.text:eq(1)&#039;, thisQuestion).val();&lt;br /&gt;
		$(&#039;tr:eq(&#039;+yCoord+&#039;) .gridCell:eq(&#039;+xCoord+&#039;)&#039;, thisTable).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the grid cells&lt;br /&gt;
		$(&#039;.gridCell&#039;).click(function(){&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Add class to checked cell&lt;br /&gt;
			$(&#039;.checkedCell&#039;, thisQuestion).removeClass(&#039;checkedCell&#039;);&lt;br /&gt;
			$(this).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Find the cell coordinates&lt;br /&gt;
			var reverseRowIndex = (numRows - $(&#039;tr&#039;, thisTable).index($(thisRow)));&lt;br /&gt;
			var colIndex = $(&#039;.gridCell&#039;, thisRow).index($(this)) + 1;&lt;br /&gt;
	&lt;br /&gt;
			// Load coordinates into inputs&lt;br /&gt;
			$(&#039;input.text:eq(0)&#039;, thisQuestion).val(colIndex);&lt;br /&gt;
			$(&#039;input.text:eq(1)&#039;, thisQuestion).val(reverseRowIndex);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The script should automatically handle different grid sizes.&lt;br /&gt;
&lt;br /&gt;
=Slider Highlighting=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may want to highlight a slider after it has been moved/changed to allow respondents to easily see which slider subquestions have been answered.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture.PNG]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;template.js&#039;&#039;&#039;:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&#039;html&#039;).bind(&#039;slidecreate&#039;, function(event, ui) {&lt;br /&gt;
	$(&#039;.slider_callout&#039;).each(function(i){&lt;br /&gt;
		if($(this).text().length &amp;gt; 0) {&lt;br /&gt;
			$(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	$(&#039;.ui-slider-horizontal&#039;).bind(&#039;slidechange&#039;, function(event, ui) {&lt;br /&gt;
	 $(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and would need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.numeric-multi .answer li {&lt;br /&gt;
	border-bottom: 5px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li label {&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li div.multinum-slider {&lt;br /&gt;
	margin: 1.5em 0.5em 0.2em 0;&lt;br /&gt;
	padding-left: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ui-slider-1 {&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.changedSlider {&lt;br /&gt;
	background-color: #99FFFF;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Dynamic Slider Call-Out Styles=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 9-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is an example of how to insert a custom &#039;&#039;&#039;&#039;&#039;slide()&#039;&#039;&#039;&#039;&#039; function to control the appearance of the slider call-out as the slider is manipulated. In this example the call-out text colour changes as the slider is moved. Sample survey here - [[Media:Dynamic_slider_call_out.lss|dynamic call-out slider survey]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Dynamic_slider_call_out.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
 &lt;br /&gt;
		// Slide function&lt;br /&gt;
		$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function( event, ui ) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), ui.value);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Initial callout states&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), $(this).val());&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Handle the callout style&lt;br /&gt;
		function handleCallout(thisRow, sliderVal) {&lt;br /&gt;
			if(sliderVal &amp;lt; 20) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D90000&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 40) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D96D00&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 60) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D9D900&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#00B22D&#039;);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sliders in Array-Numbers or Array-Dual-Scale-Numbers=&lt;br /&gt;
&lt;br /&gt;
This workaround will replace the dropdowns in &#039;&#039;&#039;&#039;&#039;array-numbers&#039;&#039;&#039;&#039;&#039; or &#039;&#039;&#039;&#039;&#039;array-dual-scale-numbers&#039;&#039;&#039;&#039;&#039; questions with sliders. The sliders will automatically have the same minimum, maximum and steps that you set in the advanced question settings.&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.06==&lt;br /&gt;
[[File:custom_sliders_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; select&#039;).each(function(i, el){&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				var id = $(el).attr(&#039;id&#039;).replace(/#/g,&#039;-&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = Number($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).val());&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).next(&#039;option&#039;).val());&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Insert a container for the slider&lt;br /&gt;
				var container = $(&#039;&amp;lt;div class=&amp;quot;customSliderWrapper&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				var slider = $(&#039;&amp;lt;div id=&amp;quot;slider-&#039;+id+&#039;&amp;quot; class=&amp;quot;customSlider&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo(container).slider({&lt;br /&gt;
					min: firstVal,&lt;br /&gt;
					max: lastVal,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					value: currentVal,&lt;br /&gt;
					step: secondVal - firstVal,&lt;br /&gt;
					slide: function( event, ui ) {&lt;br /&gt;
						$(el).val(ui.value);&lt;br /&gt;
						$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
&lt;br /&gt;
				// Insert a callout&lt;br /&gt;
				var callout = $(&#039;&amp;lt;div id=&amp;quot;callOut-&#039;+id+&#039;&amp;quot; class=&amp;quot;slider_callout slider-callout&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo($(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;)).text($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Set a value as soon as the slider handle is clicked&lt;br /&gt;
				$(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;).mousedown(function() {&lt;br /&gt;
					$(el).val(slider.slider(&#039;value&#039;));&lt;br /&gt;
					$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.customSliderWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 10px;&lt;br /&gt;
	padding-top: 1.75em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey Version 2.6x==&lt;br /&gt;
[[File:Dropdown-sliders.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.64.7 &#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
			&lt;br /&gt;
			// Identify this question&lt;br /&gt;
			var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
			thisQuestion.addClass(&#039;with-dropdown-sliders&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through all array drop-downs&lt;br /&gt;
			$(&#039;select.multiflexiselect&#039;, thisQuestion).each(function(i, el){&lt;br /&gt;
				var thisCell = $(el).closest(&#039;td&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = $(el).val();&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:eq(1)&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
&lt;br /&gt;
				// Insert an input for the slider&lt;br /&gt;
				var thisInput = $(&#039;&amp;lt;input class=&amp;quot;inserted-input&amp;quot; type=&amp;quot;text&amp;quot; /&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
				&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				thisInput.val(currentVal).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: firstVal,&lt;br /&gt;
					&#039;max&#039;: lastVal,&lt;br /&gt;
					&#039;step&#039;: secondVal - firstVal,&lt;br /&gt;
					&#039;value&#039;: Number(currentVal),&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Listener on the slider&lt;br /&gt;
				$(thisInput).on(&#039;slideStop&#039;, function () {&lt;br /&gt;
					if($(&#039;.tooltip&#039;, thisCell).is(&#039;:hidden&#039;)) {&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).show();&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).css(&#039;margin-left&#039;, &#039;-&#039;+($(&#039;.tooltip&#039;, thisCell).width()/2)+&#039;px&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(el).val($(thisInput).val());&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Hide the slider call-out if no value selected yet&lt;br /&gt;
				if(currentVal == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.tooltip&#039;, thisCell).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal {&lt;br /&gt;
    margin: 1.5em auto  1em auto;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey for version 2.6x: [[Media:Demo_Sliders_in_Array_Survey.zip|Demo_Sliders_in_Array_Survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Vertical Sliders=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, 2.00+, IE 9, Firefox 13, Chrome 19&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to apply vertical sliders to multiple-numeric questions. You can download a sample template here (with the plugin in template.js) - [[Media:default_vertical_sliders.zip|vertical slider template]] - and a sample survey here - [[Media:demo_vertical_sliders.lss|vertical slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:verticalsliders_1.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question(s). Do NOT use any of the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js. Replace &amp;quot;QQ&amp;quot; (line 5) with the question ID and adjust the options in the function call as desired. Repeat the call as many times as you need for more questions&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
	// Call the vertical slider plugin with the question ID&lt;br /&gt;
	// Edit options here as desired&lt;br /&gt;
	$(&#039;#questionQQ&#039;).lsVerticalSlider({&lt;br /&gt;
		minValue		:0,		// Minimum value (default 0)&lt;br /&gt;
		maxValue		:200,	// Maximum value (default 100)&lt;br /&gt;
		startValue		:100,	// Start value (default null)&lt;br /&gt;
		step			:10,	// Slider increments (default 1)&lt;br /&gt;
		height			:100,	// Height of slider in pixels (default 200)&lt;br /&gt;
		recordStart		:true,	// Record the start value? (default no)&lt;br /&gt;
		showMin			:true,	// Show minimum value? (default no)&lt;br /&gt;
		showMax			:true	// Show maximum value? (default no)&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
// NO EDITING REQUIRED BELOW HERE&lt;br /&gt;
// A jQuery plugin to convert multiple-numeric questions to vertical sliders&lt;br /&gt;
(function( $ ){&lt;br /&gt;
	$.fn.lsVerticalSlider = function(options) {&lt;br /&gt;
&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			minValue		:0,&lt;br /&gt;
			maxValue		:100,&lt;br /&gt;
			startValue		:&#039;&#039;,&lt;br /&gt;
			step			:1,&lt;br /&gt;
			height			:150,&lt;br /&gt;
			recordStart		:false,&lt;br /&gt;
			showMin			:false,&lt;br /&gt;
			showMax			:false&lt;br /&gt;
		}, options);&lt;br /&gt;
&lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
&lt;br /&gt;
			var $this = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Some classes for the question and subquestions&lt;br /&gt;
			$this.addClass(&#039;vertical-slider-question&#039;);&lt;br /&gt;
			$(&#039;li:[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).addClass(&#039;vertical-slider-subquestion&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through the subquestions&lt;br /&gt;
			$(&#039;li:[id&amp;lt;/div&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).each(function(i){&lt;br /&gt;
				var itemID = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) {&lt;br /&gt;
					opts.startValue = $(&#039;#answer&#039;+itemID).val();&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Insert the slider elements&lt;br /&gt;
				$(&#039;#answer&#039;+itemID).after(&lt;br /&gt;
					&#039;&amp;lt;div class=&amp;quot;vertical-slider-max-min&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-max&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-min&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div id=&amp;quot;vertical-slider-&#039;+itemID+&#039;&amp;quot; class=&amp;quot;vertical-slider&amp;quot; style=&amp;quot;height:&#039;+opts.height+&#039;px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div class=&amp;quot;vertical-slider-callout-wrapper&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-callout&amp;quot; id=&amp;quot;slider-callout-&#039;+itemID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt;&#039;&lt;br /&gt;
				);&lt;br /&gt;
&lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.vertical-slider-max&#039;, $this).text(opts.maxValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.vertical-slider-min&#039;, $this).text(opts.minValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				$(&#039;#vertical-slider-&#039;+itemID).slider({&lt;br /&gt;
					orientation: &#039;vertical&#039;,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					min: opts.minValue,&lt;br /&gt;
					max: opts.maxValue,&lt;br /&gt;
					value: opts.startValue,&lt;br /&gt;
					step: opts.step,&lt;br /&gt;
					slide: function(event, ui) {&lt;br /&gt;
						$(&#039;#answer&#039;+itemID).val(ui.value);&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).text(ui.value);&lt;br /&gt;
						setTimeout(function() {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) }).show();&lt;br /&gt;
						}, 10);&lt;br /&gt;
					},&lt;br /&gt;
					create: function(event, ui) {&lt;br /&gt;
						// Initial values and positions&lt;br /&gt;
						if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) { // Pre-existing answer&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else if(opts.recordStart) { // Record the start value (if option is set)&lt;br /&gt;
							$(&#039;#answer&#039;+itemID).val(opts.startValue);&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).hide();&lt;br /&gt;
						}&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) });&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Vertical slider styles and overrides */&lt;br /&gt;
.vertical-slider-question p.tip {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-subquestion {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 0 3em 0 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question label {&lt;br /&gt;
	display: block;&lt;br /&gt;
	padding: 0 0 0.75em 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question span.input {&lt;br /&gt;
	padding: 0.3em 0 0 0;&lt;br /&gt;
	display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question input.text {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider {&lt;br /&gt;
	float: left;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question .ui-slider-handle {&lt;br /&gt;
	top: auto;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min,&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	position: relative;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	min-width: 3em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min {&lt;br /&gt;
	margin-right: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max,&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	font-size: 0.8em;&lt;br /&gt;
	color:#666666;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max {&lt;br /&gt;
	margin-top: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	right: 0;&lt;br /&gt;
	bottom: 0;&lt;br /&gt;
	margin-bottom: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	top: auto;&lt;br /&gt;
	margin: 0 0 -0.6em 0.5em;&lt;br /&gt;
	padding: 0.1em;&lt;br /&gt;
	font-size: 0.9em;&lt;br /&gt;
	color:#000000;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	background: #F8F8FF;&lt;br /&gt;
	border: 1px solid #D2E0F2;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Range Slider=&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert a jQuery UI range slider into a multi-numeric question and automatically populate that question&#039;s inputs with the range min and max values.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039;: [[Media:Demo_Range_Slider_2.5x.zip|Sample Template and Survey.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_Range_Slider_2.5x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin handles:&lt;br /&gt;
*previous answers&lt;br /&gt;
*slider max/min&lt;br /&gt;
*range min start&lt;br /&gt;
*range max start&lt;br /&gt;
*range span min&lt;br /&gt;
*slider step&lt;br /&gt;
*record the start values&lt;br /&gt;
*show slider max and min&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;LimeSurvey 2.5x&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A multiple-numeric question with two subquestions&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create your multi-numeric question. Do NOT use any of the slider advanced settings.&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A jQuery plugin to display a range slider in LimeSurvey&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.lsRangeSlider = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:100, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:&#039;&#039;, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:&#039;&#039;, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:false, // Record the start value? (default no)&lt;br /&gt;
			showMin			:false, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:false // Show slider maximum value? (default no)&lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
 &lt;br /&gt;
			if($(this).hasClass(&#039;numeric-multi&#039;) &amp;amp;&amp;amp; $(&#039;input.text&#039;, this).length == 2) {&lt;br /&gt;
 &lt;br /&gt;
				// Define some vars	&lt;br /&gt;
				var thisQuestion = $(this);&lt;br /&gt;
				var rangeMinInput = $(&#039;input.text.form-control:eq(0)&#039;, thisQuestion); &lt;br /&gt;
				var rangeMaxInput = $(&#039;input.text.form-control:eq(1)&#039;, thisQuestion); &lt;br /&gt;
				thisQuestion.addClass(&#039;range-slider-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() != &#039;&#039;) {&lt;br /&gt;
					opts.rangeStartMin = $(rangeMinInput).val();&lt;br /&gt;
					opts.rangeStartMax = $(rangeMaxInput).val();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					if(opts.rangeStartMin == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMin = opts.sliderMin;&lt;br /&gt;
					}&lt;br /&gt;
					if(opts.rangeStartMax == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMax = opts.sliderMax;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
		&lt;br /&gt;
				// Insert the slider&lt;br /&gt;
				var insertedEls = &#039;&amp;lt;div class=&amp;quot;col-xs-12 col-sm-12 withslider&amp;quot;&amp;gt;\&lt;br /&gt;
										&amp;lt;input class=&amp;quot;inserted-slider&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;rangeSlider&amp;quot; /&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-left&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-min&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-right&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-max&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;].form-control:eq(0)&#039;, thisQuestion).closest(&#039;.subquestion-list&#039;).hide().before(insertedEls);&lt;br /&gt;
				&lt;br /&gt;
				var sliderValues = [Number(opts.rangeStartMin), Number(opts.rangeStartMax)];&lt;br /&gt;
			&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: Number(opts.sliderMin),&lt;br /&gt;
					&#039;max&#039;: Number(opts.sliderMax),&lt;br /&gt;
					&#039;step&#039;: Number(opts.step),&lt;br /&gt;
					&#039;range&#039;: true,&lt;br /&gt;
					&#039;value&#039;: sliderValues,&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider .tooltip&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
						&lt;br /&gt;
				// Listener on the range slider&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slideStart&#039;, function(event, ui) {&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slide slideStop&#039;, function(event, ui) {&lt;br /&gt;
					var thisLowerVal = Number($.trim($(this).val().split(&#039;,&#039;)[0]));&lt;br /&gt;
					var thisUpperVal = Number($.trim($(this).val().split(&#039;,&#039;)[1]));&lt;br /&gt;
					if(opts.minRangeSpan &amp;gt; 0 &amp;amp;&amp;amp; (thisUpperVal-thisLowerVal) &amp;lt; opts.minRangeSpan) {&lt;br /&gt;
						$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider(&#039;setValue&#039;, sliderValues);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(thisLowerVal);&lt;br /&gt;
						$(rangeMaxInput).val(thisUpperVal);&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
						sliderValues = [thisLowerVal, thisUpperVal];&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
 &lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.inserted-slider-min&#039;, thisQuestion).text(opts.sliderMin);&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.inserted-slider-max&#039;, thisQuestion).text(opts.sliderMax);&lt;br /&gt;
				}&lt;br /&gt;
				&lt;br /&gt;
				// Handle recordStart&lt;br /&gt;
				if(opts.recordStart) {&lt;br /&gt;
					if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[0])));&lt;br /&gt;
						$(rangeMaxInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[1])));&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider({&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:10, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:2, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:8, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:true, // Record the start value? (default no)&lt;br /&gt;
			showMin			:true, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:true // Show slider maximum value? (default no)&lt;br /&gt;
		});&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Or, to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider();&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Reverse Slider=&lt;br /&gt;
&lt;br /&gt;
{{Box|The reverse slider feature can be used in any (multiple) numerical input question type. For more details, please check the [[Question_type_-_Multiple_numerical_input#Slider|slider wiki subsection]].}}&lt;br /&gt;
&lt;br /&gt;
=Sliders With Control Buttons=&lt;br /&gt;
== Version 2.05 ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 7-10, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert &amp;quot;up&amp;quot; and &amp;quot;down&amp;quot; buttons to control sliders. You can download a sample template here - [[Media:Demo_Slider_Buttons.zip|slider with buttons template]] - and a sample survey here - [[Media:Limesurvey_survey_button_slider.lss|button slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:Button_slider.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin allows the following options:&lt;br /&gt;
*Down Text: Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
*Up Text: Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
*Scrolling: Continuous slider movement if the left mouse button is held down&lt;br /&gt;
*Scroll Interval: Interval (in milliseconds) between slider movement when button is held down (do not make this too short or it will be difficult to stop the slider accurately)&lt;br /&gt;
*Value Prefix: Prefix for call-out&lt;br /&gt;
*Value Suffix: Suffix for call-out&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A custom plugin to add control buttons to LimeSurvey sliders&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.sliderButtons = function(options) {&lt;br /&gt;
	&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
		downText: &#039;-&#039;,		// Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
		upText: &#039;+&#039;,		// Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
		scrolling: true,	// Continuous slider movement if left mouse button held down&lt;br /&gt;
		scrollInterval: 150,// Interval (in ms) between slider movement when button is held down&lt;br /&gt;
		valuePrefix: &#039;&#039;,	// Prefix for callout&lt;br /&gt;
		valueSuffix: &#039;&#039;	// Suffix for callout&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function(i) {&lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
	&lt;br /&gt;
			// Add some classes&lt;br /&gt;
			$(thisQuestion).addClass(&#039;slider-button-question&#039;);		&lt;br /&gt;
			&lt;br /&gt;
			// Insert the buttons&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;slider-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button down&amp;quot;&amp;gt;&#039;+opts.downText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button up&amp;quot;&amp;gt;&#039;+opts.upText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
														&amp;lt;/div&amp;gt;&#039;);			&lt;br /&gt;
			&lt;br /&gt;
			// Initial button states&lt;br /&gt;
			function handleButtonState(slider) {&lt;br /&gt;
				var thisRow = $(slider).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSliderVal = $(slider).slider(&#039;option&#039;, &#039;value&#039;);&lt;br /&gt;
				var thisSliderStep = $(slider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var thisSliderMin = $(slider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(slider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisRow).prop(&#039;disabled&#039;, false);&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMin) {&lt;br /&gt;
					$(&#039;button.slider-button.down&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMax) {&lt;br /&gt;
					$(&#039;button.slider-button.up&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				handleButtonState(this);	&lt;br /&gt;
				if($(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val() != &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider-callout&#039;, this).text(opts.valuePrefix+$(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val()+opts.valueSuffix);&lt;br /&gt;
				}&lt;br /&gt;
			});	&lt;br /&gt;
			&lt;br /&gt;
			// Function to handle button actions&lt;br /&gt;
			function handleButtons(thisButton) {&lt;br /&gt;
				var thisRow = $(thisButton).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSlider = $(&#039;.multinum-slider&#039;, thisRow);&lt;br /&gt;
				var thisSliderStep = $(thisSlider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var stepDecimals = 0;&lt;br /&gt;
				if(thisSliderStep.toString().indexOf(&#039;.&#039;) &amp;gt;= 0) {&lt;br /&gt;
					stepDecimals = thisSliderStep.toString().split(&#039;.&#039;)[1].length;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSliderVal = Number($(thisSlider).slider(&#039;option&#039;, &#039;value&#039;)).toFixed(stepDecimals);&lt;br /&gt;
				var thisSliderMin = $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;down&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;gt; thisSliderMin) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)-Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;up&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;lt; thisSliderMax) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)+Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				var newValue = $(thisSlider).slider(&#039;option&#039;, &#039;value&#039;).toFixed(stepDecimals).replace(/\./, LSvar.sLEMradix);&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(newValue).triggerHandler(&#039;keyup&#039;);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisSlider).text(opts.valuePrefix+newValue+opts.valueSuffix);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Scrolling&lt;br /&gt;
			if(opts.scrolling == true) {&lt;br /&gt;
					&lt;br /&gt;
				var sliderTimeout;&lt;br /&gt;
				var clicker = $(&#039;button.slider-button&#039;, thisQuestion);&lt;br /&gt;
				var count = 0;&lt;br /&gt;
&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mousedown(function(){&lt;br /&gt;
					var thisButton = $(this);&lt;br /&gt;
					sliderTimeout = setInterval(function(){&lt;br /&gt;
						handleButtons(thisButton);&lt;br /&gt;
					}, opts.scrollInterval);				&lt;br /&gt;
					return false;&lt;br /&gt;
				});				&lt;br /&gt;
				&lt;br /&gt;
				$(document).mouseup(function(){&lt;br /&gt;
					clearInterval(sliderTimeout);&lt;br /&gt;
					return false;&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mouseout(function(){&lt;br /&gt;
					handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Listener on the buttons&lt;br /&gt;
			$(&#039;button.slider-button&#039;, thisQuestion).click(function(e) {&lt;br /&gt;
				handleButtons(this)	;		&lt;br /&gt;
				handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on sliders&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function( event, ui ) {&lt;br /&gt;
				handleButtonState(this);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on reset buttons&lt;br /&gt;
			$(&#039;.slider-reset&#039;, thisQuestion).on( &amp;quot;click&amp;quot;, function( event, ui ) {&lt;br /&gt;
				var thisReset = $(this);&lt;br /&gt;
				setTimeout(function() {&lt;br /&gt;
					handleButtonState($(thisReset).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				}, 150);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template but easily modified for others):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.slider-button-question label.slider-label {&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    padding: 40px 1em 0 0;&lt;br /&gt;
    *padding: 25px 1em 0 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question div.multinum-slider {&lt;br /&gt;
	margin-top: 45px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .ui-slider-horizontal .ui-slider-handle {&lt;br /&gt;
	width: 18px;&lt;br /&gt;
    margin-left: -9px;&lt;br /&gt;
    top: -4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider_callout {&lt;br /&gt;
    margin-left: -41px;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
    width: 100px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 40px 0 0 25px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button {&lt;br /&gt;
	padding: 0 10px;&lt;br /&gt;
	margin: 0 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button:disabled {&lt;br /&gt;
	opacity:0.65;&lt;br /&gt;
	filter:alpha(opacity=65);&lt;br /&gt;
	cursor: default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-reset {&lt;br /&gt;
	margin-top: 42px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons({&lt;br /&gt;
			downText: &#039;Down&#039;, // Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
			upText: &#039;Up&#039;, // Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
			scrolling: true, // Continuous slider movement if left mouse button held down&lt;br /&gt;
			scrollInterval: 250, // Interval (in ms) between slider movement when button is held down&lt;br /&gt;
			valueSuffix: &amp;quot;%&amp;quot;	// Suffix for callout&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Or, simply to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons();&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Slider Control Buttons for LimeSurvey 3.x can be found here - https://github.com/tpartner/LimeSurvey-Slider-Controls-3x&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176530</id>
		<title>Workarounds: Question design, layout and templating</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176530"/>
		<updated>2023-05-11T17:28:57Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Star Rating System Using Numeric Input Question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This section more or less deals with styling your survey, adjusting the layout and setting up special question types. You can find &#039;&#039;&#039;similar information&#039;&#039;&#039; at these pages:&lt;br /&gt;
* [[The template editor]]&lt;br /&gt;
* [[Workarounds: Manipulating a survey at runtime using Javascript]]&lt;br /&gt;
* [[Workarounds: Survey behaviour]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves. &amp;lt;span style=&#039;color:#EE0000&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Different progress indicator=&lt;br /&gt;
&lt;br /&gt;
==Version 1.87 and later:==&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will find the progress value and insert it into the element following the progress bar.&lt;br /&gt;
&lt;br /&gt;
It should be pointed out that I had to introduce a delay in firing the function because the progress value is not calculated until after template.js is called. The delay is set at 1/10 of a second but you may be able to reduce that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // Display progress value&lt;br /&gt;
&lt;br /&gt;
   function setProgValue() {&lt;br /&gt;
&lt;br /&gt;
       var progress = $(&#039;#progressbar&#039;).attr(&#039;aria-valuenow&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).text(progress+&#039;%&#039;).show();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
       setTimeout(&#039;setProgValue()&#039;,100);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to hide the &amp;quot;0%&amp;quot; before the progress bar, add the following to the end of template.css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
#progress-pre {&lt;br /&gt;
&lt;br /&gt;
   display: none;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Delete unwanted gaps in question title=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When copying data (questions, answers, ...) from MS Word or other applications into the editor there might occur some gaps in the question title.&lt;br /&gt;
&lt;br /&gt;
There are two solutions to this:&lt;br /&gt;
# Use popup mode and manually delete unwanting extra html tags (requires html knowledge).&lt;br /&gt;
# Disable paste word feature: Tweak your limesurvey-config.js file in limesurvey/admin/scripts/fckeditor.26 and set the following option to true:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;FCKConfig.ForcePasteAsPlainText = true ;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that clear you browser cache and try again.&lt;br /&gt;
&lt;br /&gt;
=How to change the &amp;lt;font-size&amp;gt; tags using CSS=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This workaround was deleted because it is outdated. Such changes can be done by [[The template editor#Styling questions with CSS|adjusting template.css]] of your template.&lt;br /&gt;
&lt;br /&gt;
=Question type variation: Scale with bars (one and two sided)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some methodogical issues to think about: Very often a common scale as 1 to 5 or -2 to +2 fits all needs, as the shown subject is clearly defined as positive or negative. As soon as you would reduce the influence from the question and scale on the respondent, you will need something neutral to determine tendences, emphases and so on.&lt;br /&gt;
&lt;br /&gt;
So I put up a new variation of the one and two sided array question:&lt;br /&gt;
&lt;br /&gt;
ttp://www.limesurvey.org/images/fbfiles/images/example_bar_scale.jpg&lt;br /&gt;
&lt;br /&gt;
In my example the left side reads &amp;quot;strategical planning&amp;quot; and the right side &amp;quot;operative business&amp;quot;. None of these are purely negative or positive, so the bars only show in which direction the balancing point moves.&lt;br /&gt;
&lt;br /&gt;
To realize a question as shown above just do as follows:&lt;br /&gt;
&lt;br /&gt;
Set up as many bars as you will need (in my example there are four different bars in total) with a graphic program like PAINT .NET, GIMP or similar ones (yes, you may also use commercial software like Photoshop). To prevent the bars from looking twitchy, designate the size in advance. I did one bar 60x15 px, one 45x15px, one 30x15px and at last 15x15px. Save them as PNG, JPG or GIF.&lt;br /&gt;
# Create a new label set within Lime. Call it whatever you like.&lt;br /&gt;
# Enter a code number at first, then press the pencil symbol to enter the editor.&lt;br /&gt;
#Press the &amp;quot;Insert / edit image&amp;quot; button and upload the bar you want to insert with the FCK upload tool. Then choose the uploaded picture, save and leave the FCK editor.&lt;br /&gt;
#The row in the lable editor now shows an &amp;lt;img&amp;gt;-tag which refers to your bar picture.&lt;br /&gt;
#Repeat the above described steps as often as needed to build up your bar scale.&lt;br /&gt;
&lt;br /&gt;
=Doing a Likert Scale=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A Likert Scale is a special type of the Semantic Differential question where several item shall be rated on different scales, each marked at the beginning and at the end with opposite statements. &lt;br /&gt;
&lt;br /&gt;
To do this in LimeSurvey just follow these steps:&lt;br /&gt;
#Create a label set with values from 0 to 7 (for the classic Likert Scale - feel free to choose other ranges).&lt;br /&gt;
#Create a new question and choose Array (Flexible Labels) as question type.&lt;br /&gt;
#Assign the Likert Scale label set to this question.&lt;br /&gt;
#Enter your answers as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;DIV style=&amp;quot;white-space: nowrap;&amp;quot;&amp;gt;ITEM statement1|statement2&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The white-space style is to avoid line breaks which would ruin the whole scale. feel free to insert non-breakable spaces between the ITEM and statement1 to define the margin between these to strings.&lt;br /&gt;
&lt;br /&gt;
=Alternate background colour of questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To alternate the background colour of questions, open the &#039;&#039;template.css&#039;&#039; of your template with the Template Editor or a text editor and modify the &#039;&#039;Question styles&#039;&#039; section to include the following style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
div#question2 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question4 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question6 td.questiontext {&lt;br /&gt;
&lt;br /&gt;
   background-color: #E0EBF8;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to apply the style to all of the questions you would like modified using their question IDs (&#039;&#039;question2, question4, question6&#039;&#039; in this case). Question IDs are displayed when creating or editing questions - see below:&lt;br /&gt;
&lt;br /&gt;
[[File:qid_1_493x173.gif]]&lt;br /&gt;
&lt;br /&gt;
Here the question ID is #question80 .&lt;br /&gt;
&lt;br /&gt;
=Embedding audio in questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191), IE 7, FireFox 3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Audio clips can be embedded in most question text or answer text. In this example, using the default template, I&#039;ve embedded clips into the answers of an &#039;&#039;&#039;&#039;&#039;Array (Yes/No/Uncertain)&#039;&#039;&#039;&#039;&#039; question to ask respondents how they feel about some sounds. The resulting question will look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x202.gif]]&lt;br /&gt;
&lt;br /&gt;
It&#039;s accomplished by placing the following code in each of the answers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;embed height=&amp;quot;20&amp;quot; width=&amp;quot;128&amp;quot; autostart=&amp;quot;false&amp;quot; controls=&amp;quot;console&amp;quot;&lt;br /&gt;
&lt;br /&gt;
loop=&amp;quot;true&amp;quot; volume=&amp;quot;50&amp;quot; src=&amp;quot;{TEMPLATEURL}audio_1.mp3&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some notes about the code:&lt;br /&gt;
*The &#039;&#039;audio_1.mp3&#039;&#039; part will be different for each answer (it&#039;s the audio file name).&lt;br /&gt;
*In this case the audio files are residing in the template folder being used for this survey (that&#039;s where &#039;&#039;{TEMPLATEURL}&#039;&#039; points to) but they can be placed anywhere if you use an absolute URL in the &#039;&#039;src&#039;&#039; parameter - something like &#039;&#039;src=&amp;quot;http://mysite.com/audio/audio_1.mp3&amp;quot;&#039;&#039;&lt;br /&gt;
*If the audio file doesn&#039;t exist where the &#039;&#039;src&#039;&#039; parameter indicates, the player will not appear.&lt;br /&gt;
*You&#039;ll need to insert the code into the answers using the source screen - click on &amp;quot;Edit answers&amp;quot;, click the pencil beside the text box, click &amp;quot;Source&amp;quot; in the pop-up, enter the code and save it with the little diskette icon.&lt;br /&gt;
*You may need to turn off the XSS filter - see the documentation for [http://docs.limesurvey.org/tiki-index.php?page=Global+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Security Global settings].&lt;br /&gt;
&lt;br /&gt;
Although the above example places the audio in the answer text of the question, the same principles can be used to place it in the question text itself. Something like this perhaps.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x154.gif]]&lt;br /&gt;
&lt;br /&gt;
=Hiding inputs of a &amp;quot;Multiple options with comments&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
There may be times when you want to hide some of the input boxes of a &#039;&#039;&#039;&#039;&#039;Multiple choice question type with comments&#039;&#039;&#039;&#039;&#039; question as in the image below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:hidden_inputs_541x168.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This can be accomplished with CSS (see [[The template editor#Styling questions with CSS|Styling questions in LimeSurvey 1.8]]). For each input that you want to hide, add the following style to your template.css file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
#answer11111X22X33Acomment {&lt;br /&gt;
   display: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where 11111 is your survey ID, 22 is your group ID, 33 is your question ID and A is the answer code.&lt;br /&gt;
&lt;br /&gt;
Note that you will still see columns for the hidden inputs in your data but they will be empty.&lt;br /&gt;
&lt;br /&gt;
=Multiple question types in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90 - 1.92+, IE 7/8/9, Firefox 13, Safari 5, Chrome 10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Media:limesurvey_survey_62584.lss|Download the sample survey]]&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present multiple question types in what appears to be an array - as depicted in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=62584&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here] (download the sample survey - [[Media:limesurvey_survey_62584.lss|limesurvey_survey_62584.lss]]). This example uses the default template but should be adaptable to any template using divisions for question containers.&lt;br /&gt;
&lt;br /&gt;
[[File:inline_questions_700x228.png]]&lt;br /&gt;
&lt;br /&gt;
Basically what we do is take groups of questions (5 in this case), wrap them in a division and make them line up nicely horizontally and vertically. The width of the survey is also fixed to prevent wrapping issues. We do this with a JavaScript/jQuery function that inserts the necessary wrappers and then modifies styles so everything behaves properly. The top row is 5 boilerplate questions with the &amp;quot;column headers&amp;quot; as question text (the first just has a blank space). The following rows are a boilerplate with the &amp;quot;row headers&amp;quot; followed by 4 assorted questions.&lt;br /&gt;
&lt;br /&gt;
It should be noted that using conditions on these questions may result in unexpected behavior. If a question is hidden by conditions, the question(s) to the right of it will move over to take its place.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Create your questions keeping in mind how they will lay out when grouped into rows (in this example - boilerplate, yes/no, short text, numeric, dropdown, and repeat).&lt;br /&gt;
#In the source of the first boilerplate question add the function below (see [http://manual.limesurvey.org/wiki/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F How to use script]).&lt;br /&gt;
#Modify the number of rows, number of columns and the start placement in the function call (line 6) as required (the example uses 4 rows and 5 columns and the &amp;quot;array&amp;quot; starts with the third question on the page).&lt;br /&gt;
&lt;br /&gt;
The code may look intimidating at first but it&#039;s actually fairly simple. I&#039;ve laid it out as sequentially as possible and purposely used few shortcuts and many comments to make it easier to follow.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
*If you use question types other than boilerplate, short text, list dropdown, numeric or yes-no, you&#039;ll need to add to the last section of code, where it hides the question text and formats the inputs for display this way.&lt;br /&gt;
*Any extra questions on the page should follow this grid of questions, not precede them.&lt;br /&gt;
* If you use boilerplate as question type you should add after:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
the following 2 lines&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
//repair boilerplate questioncells&lt;br /&gt;
$(&#039;div.boilerplate td.questiontext&#039;).parent().show();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Javascript code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the &amp;quot;sideBySide&amp;quot; function with number of rows, columns and start position&lt;br /&gt;
		sideBySide(4, 5, 3);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function sideBySide(rows, columns, startQuestion) {&lt;br /&gt;
&lt;br /&gt;
		/*********** Display multiple questions side by side ***********/&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;div.qRow1&#039;).length == 0) {&lt;br /&gt;
&lt;br /&gt;
			var rowNum = 0;&lt;br /&gt;
			var colNum = 1;&lt;br /&gt;
			var rowList = new Array();&lt;br /&gt;
&lt;br /&gt;
			//////// Add question classes for later use ////////&lt;br /&gt;
&lt;br /&gt;
			// Loop through all questions and add row and column specific classes&lt;br /&gt;
			$(&#039;div[id^=&amp;quot;question&amp;quot;]&#039;).each(function(i) {&lt;br /&gt;
				if(i &amp;gt;= (startQuestion-1) &amp;amp;&amp;amp; rowNum &amp;lt; rows) { // This IF condition only needed if there are questions before or following the &amp;quot;inline&amp;quot; questions&lt;br /&gt;
					$(this).addClass(&#039;qRow&#039;+rowNum+&#039;&#039;).addClass(&#039;qCol&#039;+colNum+&#039;&#039;).addClass(&#039;inlineQuestion&#039;);&lt;br /&gt;
					if(rowNum == 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;columnLabel&#039;);&lt;br /&gt;
					}  &lt;br /&gt;
					if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum == 1) {&lt;br /&gt;
						$(this).addClass(&#039;rowLabel&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;questionCell&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					if(colNum == columns) {&lt;br /&gt;
						rowList.push(&#039;qRow&#039;+rowNum+&#039;&#039;);&lt;br /&gt;
						rowNum++;&lt;br /&gt;
						colNum = 1;&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						colNum++;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).addClass(&#039;normalQuestion&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Survey layout manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Fix the width of the survey&lt;br /&gt;
			$(&#039;table.outerframe&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;900px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Wrap each &amp;quot;row&amp;quot; in a wrapper div&lt;br /&gt;
			$(rowList).each(function(i) {&lt;br /&gt;
				$(&#039;.&#039;+this+&#039;&#039;).wrapAll(&#039;&amp;lt;div id=&amp;quot;inlineWrapper&#039;+i+&#039;&amp;quot; class=&amp;quot;inlineRow&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Style the wrapper divs&lt;br /&gt;
			$(&#039;.inlineRow&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;850px&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0 auto 0 auto&#039;,&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.inlineRow:first&#039; ).css({&lt;br /&gt;
				&#039;margin-top&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get all the questions to sit politely side by side&lt;br /&gt;
			$( &#039;.inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;float&#039;: &#039;left&#039;,&lt;br /&gt;
				&#039;height&#039;:&#039;41px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;-8px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;.inlineQuestion .questionhelp&#039; ).hide();&lt;br /&gt;
			$( &#039;.inlineQuestion .survey-question-help&#039; ).parent().hide();&lt;br /&gt;
		   &lt;br /&gt;
			// A little space under the last row&lt;br /&gt;
			$( &#039;.inlineRow:last .inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Any questions not displayed inline (this is only needed if there are questions following the &amp;quot;inline&amp;quot; questions)&lt;br /&gt;
			$( &#039;.normalQuestion&#039; ).css({&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Column manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Set the column widths - can be set individually if necessary&lt;br /&gt;
			// Must add up to less than 100%&lt;br /&gt;
			$( &#039;.qCol1&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;12%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.qCol2, .qCol3, .qCol4, .qCol5&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;22%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Question manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Hide the answer element in boilerplate questions&lt;br /&gt;
			$( &#039;div.boilerplate td.answer&#039; ).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
			$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Push the question tables to 100%&lt;br /&gt;
			$( &#039;div.inlineRow table&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;100%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get everything to line up nicely vertically&lt;br /&gt;
			$( &#039;.inlineQuestion td.questiontext, .inlineQuestion td.answer p&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Adjust cell heights so everything lines up nicely horizontally&lt;br /&gt;
			$( &#039;.inlineQuestion td.answer, .inlineQuestion td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;35px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;0.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;#inlineWrapper0 .inlineQuestion&#039; ).css({ &#039;height&#039;:&#039;50px&#039; });&lt;br /&gt;
			$( &#039;#inlineWrapper0 td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;50px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Yes-no question styles&lt;br /&gt;
			$( &#039;div.yes-no ul&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;,&lt;br /&gt;
				&#039;font-size&#039;: &#039;90%&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0&#039;,&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;5px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no li&#039; ).css({&lt;br /&gt;
				&#039;padding-right&#039;: &#039;1.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no td.answer&#039; ).css({&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Short-text question styles&lt;br /&gt;
			$( &#039;div.text-short input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Numeric question styles&lt;br /&gt;
			$( &#039;div.numeric input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.numeric p.tip&#039; ).css({&lt;br /&gt;
				&#039;display&#039;: &#039;none&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get rid of the margins around select boxes&lt;br /&gt;
			$( &#039;p.question&#039; ).css({ &#039;margin&#039;:&#039;0&#039; });&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Star Rating System=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://www.fyneworks.com/jquery/star-rating/ jQuery Star Rating Plugin] to display a series of stars that are used to generate a rating value. This value is then passed to either a hidden numeric input question or a hidden list radio question. Both methods are outlined below - use one or both depending on whether you want to use [Assessments|assessments].&lt;br /&gt;
&lt;br /&gt;
The plugin uses a series of radio inputs to generate the stars (more about these below). It allows the use of whole or partial stars as shown in the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x324.png]]&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using Numeric Input Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like your rating data to be collected as a numeric value and don&#039;t want to use [[Assessments|LimeSurvey assessments]] - it&#039;s a little easier to implement.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#[http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
##jquery.MetaData.js&lt;br /&gt;
##jquery.rating.css&lt;br /&gt;
##jquery.rating.js&lt;br /&gt;
##delete.gif&lt;br /&gt;
##star.gif&lt;br /&gt;
#In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a numeric input question and then in the source of the question add as many radio inputs as star segments. For example, if you would like 5 stars, each with half-segments (as in the demo Q1), you would need 10 radio inputs and that would give rating values from 1-10.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q1 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;6&amp;quot; value=&amp;quot;6&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;7&amp;quot; value=&amp;quot;7&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;8&amp;quot; value=&amp;quot;8&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;9&amp;quot; value=&amp;quot;9&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;10&amp;quot; value=&amp;quot;10&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. A note on split stars. The stars in the above example are split in half by the &#039;&#039;{ split:2 }&#039;&#039; metadata. So if you don&#039;t want split stars, your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
7. Finally, in the source of the question add the following function after your inputs. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the numeric input and pass the rating values into it as they are changed. If the rating is canceled the numeric input is nullified. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingNumeric(11111, 22, 1); handleRatingNumeric(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingNumeric (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the numeric input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val();&lt;br /&gt;
&lt;br /&gt;
   if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the numeric question&lt;br /&gt;
&lt;br /&gt;
handleRatingNumeric (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using List (Radio) Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like to use [[Assessments|assessments]]. There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en here] (second question).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
&lt;br /&gt;
2. Set up the template to use custom onload functions. (See the [[Workarounds: Manipulating a survey at runtime using Javascript#Custom onload function|workaround here]])&lt;br /&gt;
&lt;br /&gt;
3. [http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
*jquery.MetaData.js&lt;br /&gt;
*jquery.rating.css&lt;br /&gt;
*jquery.rating.js&lt;br /&gt;
*delete.gif&lt;br /&gt;
*star.gif&lt;br /&gt;
&lt;br /&gt;
4. In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a list (radio) question with the same amount of sequentially numbered answers as star ratings. For example, if you want 5 whole-stars, you would create 5 answers, as in the image below, and this would give you ratings from 1-5. Note that the &amp;quot;Codes&amp;quot; and &amp;quot;Answers&amp;quot; must be sequential numbers.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x156_v2.png]]&lt;br /&gt;
&lt;br /&gt;
6. In the list (radio) question, set the [[Advanced question settings|hide_tip]] question attribute to 1&lt;br /&gt;
&lt;br /&gt;
7. In the source of the question add as many radio inputs as star segments. So 5 whole-stars (as in the demo Q2), would need 5 radio inputs.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q2 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. A note on split stars. The stars in the above example are whole-stars. If you want them split you need to add metadata to the class - something like &#039;&#039;{ split:2 }&#039;&#039;. So if you want half-stars your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
9. Finally, in the source of the question add the following function after your inputs. (See [http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure;=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ How to use script here])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the question radio buttons and toggle them as the rating values are changed. If the rating is canceled all question inputs are unchecked. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingRadio(11111, 22, 1); handleRatingRadio(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Onload code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingRadio (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the radio input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#question&#039; + qID + &#039; input.radio[checked=true]&#039;).attr(&#039;value&#039;);&lt;br /&gt;
&lt;br /&gt;
   //if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
   if ( rating ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio[value=&#039; + rating + &#039;]&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the radio question&lt;br /&gt;
&lt;br /&gt;
handleRatingRadio (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable column widths in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define all column widths of an array question - as shown in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here]. This example uses the default template shipped with 7557 but should be adaptable to any template.&lt;br /&gt;
&lt;br /&gt;
[[File:array_widths_701x226.gif]]&lt;br /&gt;
&lt;br /&gt;
We use a function to remove all of the widths imposed by the core code and then insert our own.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects documentation here]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Replace all instances of QQ with the question ID.&lt;br /&gt;
#In the third section of code, adjust the widths and add/remove columns as necessary. This example is for an array with a question text column followed by 3 answer columns as shown above.&lt;br /&gt;
#In the final section adjust the question text alignment to your liking&lt;br /&gt;
&lt;br /&gt;
Onload code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // Get rid of all the widths that the API imposes&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question col&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question thead td&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define a width for the question table so we can do so for its children&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Keep this to 95% or less so IE will behave&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question&#039; ).attr(&#039;width&#039;, &#039;95%&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define the column widths&lt;br /&gt;
&lt;br /&gt;
   // Add or remove columns and adjust widths as necessary but widths should add up to 100%&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Columns must be sequentially numbered starting at 0 - eg, td:eq(0), td:eq(1), td:eq(2).....&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th:eq(0)&#039; ).css({ &#039;width&#039;:&#039;10%&#039; }); // Answer text column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(0)&#039; ).css({ &#039;width&#039;:&#039;50%&#039; }); // First answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(1)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Second answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(2)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Third answer column&lt;br /&gt;
&lt;br /&gt;
   // Push the text input widths to 95% of their parent containers&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question input[type=&amp;quot;text&amp;quot;]&#039; ).css({ &#039;width&#039;:&#039;95%&#039; });&lt;br /&gt;
&lt;br /&gt;
   // Align the answer text - feel free to experiment&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th&#039; ).css({&#039;text-align&#039;:&#039;center&#039;});&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use images for radio buttons and checkboxes=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.92/2.0, using IE 9, FireFox 13, Chrome 16, Safari 5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses an adaptation of the jQuery imagetick.js plugin to replace the default radio buttons and checkboxes with images as pictured below:&lt;br /&gt;
&lt;br /&gt;
[[File:images.png]] &lt;br /&gt;
&lt;br /&gt;
This adaptation will work in the following question types:&lt;br /&gt;
*Array&lt;br /&gt;
*Array by column&lt;br /&gt;
*Array dual scale&lt;br /&gt;
*Array (5 point choice)&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
*Array (Increase-Same-Decrease)&lt;br /&gt;
*Array (Yes-No-Uncertain)&lt;br /&gt;
*Gender&lt;br /&gt;
*Yes-No&lt;br /&gt;
*Multiple choice&lt;br /&gt;
*Multiple choice with comments&lt;br /&gt;
*5 point choice&lt;br /&gt;
*List (Radio)&lt;br /&gt;
*List with comment&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey 2.0 and later implementation==&lt;br /&gt;
&lt;br /&gt;
Follow the instructions above with these changes:&lt;br /&gt;
#Download [[Media:Imagetick_lime_v2.1.zip|this modified version of the plugin for 2.0 and up]] instead of the one mentioned above and add all contained files to your template directory.&lt;br /&gt;
#Add these lines to the &amp;lt;head&amp;gt; element in your startpage.pstpl instead of the one above:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}imagetick_lime_2.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}imagetick_lime_2.css&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thanks to Jordan Boesch for the original plugin.&lt;br /&gt;
&lt;br /&gt;
=Changing the position and layout of an individual question using &amp;quot;question code&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (6536)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use this very flexible workaround you first have to apply a minor change to the question.pstpl of the used template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
needs to be changed to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this change won&#039;t change anything in the layout and can be left in the template even if you don&#039;t need this workaround. It&#039;s just a means to have a handle to actually change individual questions.&lt;br /&gt;
&lt;br /&gt;
You can then use a code such as the following in the question text to make question specific format changes. &amp;quot;SAMPLE&amp;quot; needs to be replaced with the concerning question code and javascript has to be allowed ([[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|older versions of limesurvey]], under global settings for newer versions).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.borderTop= &amp;quot;0px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginTop= &amp;quot;-62px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginLeft= &amp;quot;30px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sample code will hide the border at the top of the question, will move the whole question up by 62px and to the right by 30px. Using this workaround you can change a whole a lot of things concerning format and positions of a specific question without changing all the questions. A (German) list of all the allowed options can be found [http://de.selfhtml.org/javascript/objekte/style.htm#style_eigenschaften here].&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
==Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Assign a label set to the question - these will be the labels in the center column.&lt;br /&gt;
#Set the second parameter of the function call to true for randomized rows.&lt;br /&gt;
#Adjust the styles in lines 21-24 as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The script moves the question columns into the MaxDiff configuration and disables the opposing radio element when a selection is made.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
	&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, false);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function maxDiff(qID, randomize) {&lt;br /&gt;
		&lt;br /&gt;
		// Random number between 1 and 2&lt;br /&gt;
		// Math.floor(Math.random() * (max - min + 1)) + min;&lt;br /&gt;
		var randomNum = Math.floor(Math.random() * ((2-1)+1) + 1);&lt;br /&gt;
&lt;br /&gt;
		// Move the columns&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col:eq(1)&#039;).prependTo(&#039;colgroup.col-responses&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list thead tr:eq(0) th:eq(0)&#039;).prependTo(&#039;#question&#039;+qID+&#039; table.question thead tr:eq(0)&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Random rows&lt;br /&gt;
		if(randomize) {&lt;br /&gt;
			var rowsArr = [];&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
				$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
				rowsArr.push(i);&lt;br /&gt;
			});&lt;br /&gt;
			shuffleArray(rowsArr);&lt;br /&gt;
			$(rowsArr).each(function(i){&lt;br /&gt;
				$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody&#039;).append($(&#039;#question&#039;+qID+&#039; tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Style stuff&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col.odd&#039;).css({ &#039;background-color&#039;:&#039;transparent&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody th&#039;).css({ &#039;text-align&#039;:&#039;center&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:even td, #question&#039;+qID+&#039; table.question tbody tr:even th&#039;).css({ &#039;background-color&#039;:&#039;#F1F1F1&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:odd td, #question&#039;+qID+&#039; table.question tbody tr:odd th&#039;).css({ &#039;background-color&#039;:&#039;#FCFCFC&#039; });&lt;br /&gt;
&lt;br /&gt;
		// Prevent clicking twice in the same row&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input.radio&#039;).on(&#039;click&#039;, function () {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio&#039;).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio:checked&#039;).each(function(i) {&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				$(&#039;input.radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function shuffleArray(array) {&lt;br /&gt;
		for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
			var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
			var temp = array[i];&lt;br /&gt;
			array[i] = array[j];&lt;br /&gt;
			array[j] = temp;&lt;br /&gt;
		}&lt;br /&gt;
		return array;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Versions 2.5 and 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:MaxDiff_2.5.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Template.zip|Demo template]]&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Survey.zip|Demo survey]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Add 2 subquestions to the array - these will be the left and right columns.&lt;br /&gt;
#Add answers to the array - these will be the rows.&lt;br /&gt;
#Create a copy the default template.&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.js&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function maxDiff(qID, randomize) {&lt;br /&gt;
 &lt;br /&gt;
	// Identify some elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisTable = $(&#039;table.subquestion-list:eq(0)&#039;, thisQuestion);&lt;br /&gt;
 &lt;br /&gt;
	// Assign a new question class&lt;br /&gt;
	$(thisQuestion).addClass(&#039;max-diff-array&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Move the columns&lt;br /&gt;
	$(&#039;thead tr:eq(0)&#039;, thisTable).prepend($(&#039;thead tr:eq(0) th:eq(1)&#039;, thisTable));&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
		$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Random rows&lt;br /&gt;
	if(randomize) {&lt;br /&gt;
		var rowsArr = [];&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
			$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
			rowsArr.push(i);&lt;br /&gt;
		});&lt;br /&gt;
		shuffleArray(rowsArr);&lt;br /&gt;
		$(rowsArr).each(function(i){&lt;br /&gt;
			$(&#039;tbody&#039;, thisTable).append($(&#039;tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;, thisTable));&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	// Prevent clicking twice in the same row&lt;br /&gt;
	$(&#039;input:radio&#039;, thisQuestion).on(&#039;click&#039;, function () {&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;input:radio&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		$(&#039;input:radio:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr.answers-list&#039;);&lt;br /&gt;
			$(&#039;input:radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		});&lt;br /&gt;
	});	&lt;br /&gt;
 &lt;br /&gt;
	// Fix up the row classes&lt;br /&gt;
	var rowClass = 1;&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i) {&lt;br /&gt;
		$(this).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.css&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.max-diff-array th.answertext { &lt;br /&gt;
	text-align: center;&lt;br /&gt;
	border-right: 3px solid #FFFFFF;&lt;br /&gt;
	border-left: 3px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
/* Override the responsive &amp;quot;no-more-tables&amp;quot; stuff */&lt;br /&gt;
@media only screen and (max-width: 801px) {&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables table {&lt;br /&gt;
		display: table;&lt;br /&gt;
		border-collapse: inherit;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables thead, &lt;br /&gt;
	.max-diff-array .no-more-tables tbody {&lt;br /&gt;
		display: table-row-group;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables tr {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		position: relative;&lt;br /&gt;
		top: auto;&lt;br /&gt;
		display: table-row;&lt;br /&gt;
		border: 0 none;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables th, &lt;br /&gt;
	.max-diff-array .no-more-tables td {&lt;br /&gt;
		display: table-cell;&lt;br /&gt;
		text-align: center !important;&lt;br /&gt;
		color: #2c3e50;&lt;br /&gt;
		font-size: 15px;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array th.answertext { &lt;br /&gt;
		border-right: 3px solid #FFFFFF;&lt;br /&gt;
		border-left: 3px solid #FFFFFF;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .answer-item label span {&lt;br /&gt;
		display: none !important;&lt;br /&gt;
	}	&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add a script like this to the question source of the Array (flexible labels) question:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	   &lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, true);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Load SVG Code From Drawing Tool=&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to load a drawing tool and store the results in a huge-text question. The details are outlined in the [[Workarounds: Manipulating a survey at runtime using Javascript#Load SVG Code From Drawing Tool|JavaScript section of the workarounds]].&lt;br /&gt;
&lt;br /&gt;
=Minimum or Maximum Date in Datepicker=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note: From version 2.05 beta6, you MUST set the minimum and maximum date for the date picker directly in the advanced question attributes of the date/time question. This workaround will seize to work.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can set the minimum or maximum selectible date in a datepicker as follows&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]] and add the following to the source of the date question text or help. Replace &amp;quot;QQ&amp;quot; with the date question ID.&lt;br /&gt;
&lt;br /&gt;
For a minimum date of April 15, 2010:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date(2010, 4-1, 15) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a minimum date of the current date (today):&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date() );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a maximum date of May 10, 2015:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date(2015, 5-1, 10) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More details here - http://jqueryui.com/demos/datepicker/#option-minDate&lt;br /&gt;
&lt;br /&gt;
=Evaluative Space Grid (ESG)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 &amp;amp; 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The evaluative space grid (ESG) is a two-dimensional grid that provides a single-item measure of positivity and negativity (Larsen et al, 2009). See [http://leeds-faculty.colorado.edu/mcgrawp/pdf/larsen.norris.mcgraw.hawkley.cacioppo.2009.pdf page 4 of this PDF].&lt;br /&gt;
&lt;br /&gt;
This can be accomplished using a multiple-numeric question, some simple HTML and a little JavaScript.&lt;br /&gt;
&lt;br /&gt;
A table can be shown in the question. When a respondent clicks a grid cell in the table JavaScript loads the coordinates of the cell into the multiple-numeric question inputs.&lt;br /&gt;
&lt;br /&gt;
[[File:Space_grid_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create a Multiple Numeric question with two subquestions labelled &amp;quot;X&amp;quot; and &amp;quot;Y&amp;quot;.&lt;br /&gt;
#Add the following HTML to the source of the question to create the table:&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;spaceGrid&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td rowspan=&amp;quot;5&amp;quot; class=&amp;quot;yAxisLabel&amp;quot;&amp;gt;How NEGATIVE&amp;lt;br&amp;gt;&lt;br /&gt;
			do you feel about&amp;lt;br&amp;gt;&lt;br /&gt;
		the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td colspan=&amp;quot;5&amp;quot; class=&amp;quot;xAxisLabel&amp;quot;&amp;gt;How POSITIVE do you feel about the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following styles to the end of your template.css file:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.spaceGrid {&lt;br /&gt;
	width: auto;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.spaceGrid td {&lt;br /&gt;
	padding: 0 3px;&lt;br /&gt;
	text-align: center !important;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xAxisLabel {&lt;br /&gt;
	padding-top: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yAxisLabel {&lt;br /&gt;
	padding-right: 10px;&lt;br /&gt;
	width: 125px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xLabel {&lt;br /&gt;
	height: 20px;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yLabel {&lt;br /&gt;
	text-align: right !important;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.gridCell {&lt;br /&gt;
	width: 70px;&lt;br /&gt;
	height: 70px;&lt;br /&gt;
	border: 1px solid #666666;&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.checkedCell {&lt;br /&gt;
	background-color: #66FF00;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of your template.js file:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;	&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
	$(&#039;.spaceGrid&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
		// Define some vars&lt;br /&gt;
		var thisQuestion = $(this).closest(&#039;.numeric-multi&#039;);&lt;br /&gt;
		var thisTable = $(this).closest(&#039;table.spaceGrid&#039;);&lt;br /&gt;
		var numGridCell = $(&#039;.gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numCols = $(&#039;tr:eq(0) .gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numRows = numGridCell/numCols;&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers list&lt;br /&gt;
		$(&#039;.subquestion-list, .questions-list&#039;, thisQuestion).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Initial state&lt;br /&gt;
		var xCoord = $(&#039;input.text:eq(0)&#039;, thisQuestion).val() - 1;&lt;br /&gt;
		var yCoord = numRows - $(&#039;input.text:eq(1)&#039;, thisQuestion).val();&lt;br /&gt;
		$(&#039;tr:eq(&#039;+yCoord+&#039;) .gridCell:eq(&#039;+xCoord+&#039;)&#039;, thisTable).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the grid cells&lt;br /&gt;
		$(&#039;.gridCell&#039;).click(function(){&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Add class to checked cell&lt;br /&gt;
			$(&#039;.checkedCell&#039;, thisQuestion).removeClass(&#039;checkedCell&#039;);&lt;br /&gt;
			$(this).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Find the cell coordinates&lt;br /&gt;
			var reverseRowIndex = (numRows - $(&#039;tr&#039;, thisTable).index($(thisRow)));&lt;br /&gt;
			var colIndex = $(&#039;.gridCell&#039;, thisRow).index($(this)) + 1;&lt;br /&gt;
	&lt;br /&gt;
			// Load coordinates into inputs&lt;br /&gt;
			$(&#039;input.text:eq(0)&#039;, thisQuestion).val(colIndex);&lt;br /&gt;
			$(&#039;input.text:eq(1)&#039;, thisQuestion).val(reverseRowIndex);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The script should automatically handle different grid sizes.&lt;br /&gt;
&lt;br /&gt;
=Slider Highlighting=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may want to highlight a slider after it has been moved/changed to allow respondents to easily see which slider subquestions have been answered.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture.PNG]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;template.js&#039;&#039;&#039;:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&#039;html&#039;).bind(&#039;slidecreate&#039;, function(event, ui) {&lt;br /&gt;
	$(&#039;.slider_callout&#039;).each(function(i){&lt;br /&gt;
		if($(this).text().length &amp;gt; 0) {&lt;br /&gt;
			$(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	$(&#039;.ui-slider-horizontal&#039;).bind(&#039;slidechange&#039;, function(event, ui) {&lt;br /&gt;
	 $(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and would need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.numeric-multi .answer li {&lt;br /&gt;
	border-bottom: 5px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li label {&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li div.multinum-slider {&lt;br /&gt;
	margin: 1.5em 0.5em 0.2em 0;&lt;br /&gt;
	padding-left: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ui-slider-1 {&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.changedSlider {&lt;br /&gt;
	background-color: #99FFFF;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Dynamic Slider Call-Out Styles=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 9-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is an example of how to insert a custom &#039;&#039;&#039;&#039;&#039;slide()&#039;&#039;&#039;&#039;&#039; function to control the appearance of the slider call-out as the slider is manipulated. In this example the call-out text colour changes as the slider is moved. Sample survey here - [[Media:Dynamic_slider_call_out.lss|dynamic call-out slider survey]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Dynamic_slider_call_out.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
 &lt;br /&gt;
		// Slide function&lt;br /&gt;
		$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function( event, ui ) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), ui.value);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Initial callout states&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), $(this).val());&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Handle the callout style&lt;br /&gt;
		function handleCallout(thisRow, sliderVal) {&lt;br /&gt;
			if(sliderVal &amp;lt; 20) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D90000&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 40) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D96D00&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 60) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D9D900&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#00B22D&#039;);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sliders in Array-Numbers or Array-Dual-Scale-Numbers=&lt;br /&gt;
&lt;br /&gt;
This workaround will replace the dropdowns in &#039;&#039;&#039;&#039;&#039;array-numbers&#039;&#039;&#039;&#039;&#039; or &#039;&#039;&#039;&#039;&#039;array-dual-scale-numbers&#039;&#039;&#039;&#039;&#039; questions with sliders. The sliders will automatically have the same minimum, maximum and steps that you set in the advanced question settings.&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.06==&lt;br /&gt;
[[File:custom_sliders_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; select&#039;).each(function(i, el){&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				var id = $(el).attr(&#039;id&#039;).replace(/#/g,&#039;-&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = Number($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).val());&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).next(&#039;option&#039;).val());&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Insert a container for the slider&lt;br /&gt;
				var container = $(&#039;&amp;lt;div class=&amp;quot;customSliderWrapper&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				var slider = $(&#039;&amp;lt;div id=&amp;quot;slider-&#039;+id+&#039;&amp;quot; class=&amp;quot;customSlider&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo(container).slider({&lt;br /&gt;
					min: firstVal,&lt;br /&gt;
					max: lastVal,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					value: currentVal,&lt;br /&gt;
					step: secondVal - firstVal,&lt;br /&gt;
					slide: function( event, ui ) {&lt;br /&gt;
						$(el).val(ui.value);&lt;br /&gt;
						$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
&lt;br /&gt;
				// Insert a callout&lt;br /&gt;
				var callout = $(&#039;&amp;lt;div id=&amp;quot;callOut-&#039;+id+&#039;&amp;quot; class=&amp;quot;slider_callout slider-callout&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo($(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;)).text($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Set a value as soon as the slider handle is clicked&lt;br /&gt;
				$(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;).mousedown(function() {&lt;br /&gt;
					$(el).val(slider.slider(&#039;value&#039;));&lt;br /&gt;
					$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.customSliderWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 10px;&lt;br /&gt;
	padding-top: 1.75em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey Version 2.6x==&lt;br /&gt;
[[File:Dropdown-sliders.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.64.7 &#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
			&lt;br /&gt;
			// Identify this question&lt;br /&gt;
			var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
			thisQuestion.addClass(&#039;with-dropdown-sliders&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through all array drop-downs&lt;br /&gt;
			$(&#039;select.multiflexiselect&#039;, thisQuestion).each(function(i, el){&lt;br /&gt;
				var thisCell = $(el).closest(&#039;td&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = $(el).val();&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:eq(1)&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
&lt;br /&gt;
				// Insert an input for the slider&lt;br /&gt;
				var thisInput = $(&#039;&amp;lt;input class=&amp;quot;inserted-input&amp;quot; type=&amp;quot;text&amp;quot; /&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
				&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				thisInput.val(currentVal).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: firstVal,&lt;br /&gt;
					&#039;max&#039;: lastVal,&lt;br /&gt;
					&#039;step&#039;: secondVal - firstVal,&lt;br /&gt;
					&#039;value&#039;: Number(currentVal),&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Listener on the slider&lt;br /&gt;
				$(thisInput).on(&#039;slideStop&#039;, function () {&lt;br /&gt;
					if($(&#039;.tooltip&#039;, thisCell).is(&#039;:hidden&#039;)) {&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).show();&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).css(&#039;margin-left&#039;, &#039;-&#039;+($(&#039;.tooltip&#039;, thisCell).width()/2)+&#039;px&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(el).val($(thisInput).val());&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Hide the slider call-out if no value selected yet&lt;br /&gt;
				if(currentVal == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.tooltip&#039;, thisCell).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal {&lt;br /&gt;
    margin: 1.5em auto  1em auto;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey for version 2.6x: [[Media:Demo_Sliders_in_Array_Survey.zip|Demo_Sliders_in_Array_Survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Vertical Sliders=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, 2.00+, IE 9, Firefox 13, Chrome 19&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to apply vertical sliders to multiple-numeric questions. You can download a sample template here (with the plugin in template.js) - [[Media:default_vertical_sliders.zip|vertical slider template]] - and a sample survey here - [[Media:demo_vertical_sliders.lss|vertical slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:verticalsliders_1.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question(s). Do NOT use any of the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js. Replace &amp;quot;QQ&amp;quot; (line 5) with the question ID and adjust the options in the function call as desired. Repeat the call as many times as you need for more questions&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
	// Call the vertical slider plugin with the question ID&lt;br /&gt;
	// Edit options here as desired&lt;br /&gt;
	$(&#039;#questionQQ&#039;).lsVerticalSlider({&lt;br /&gt;
		minValue		:0,		// Minimum value (default 0)&lt;br /&gt;
		maxValue		:200,	// Maximum value (default 100)&lt;br /&gt;
		startValue		:100,	// Start value (default null)&lt;br /&gt;
		step			:10,	// Slider increments (default 1)&lt;br /&gt;
		height			:100,	// Height of slider in pixels (default 200)&lt;br /&gt;
		recordStart		:true,	// Record the start value? (default no)&lt;br /&gt;
		showMin			:true,	// Show minimum value? (default no)&lt;br /&gt;
		showMax			:true	// Show maximum value? (default no)&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
// NO EDITING REQUIRED BELOW HERE&lt;br /&gt;
// A jQuery plugin to convert multiple-numeric questions to vertical sliders&lt;br /&gt;
(function( $ ){&lt;br /&gt;
	$.fn.lsVerticalSlider = function(options) {&lt;br /&gt;
&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			minValue		:0,&lt;br /&gt;
			maxValue		:100,&lt;br /&gt;
			startValue		:&#039;&#039;,&lt;br /&gt;
			step			:1,&lt;br /&gt;
			height			:150,&lt;br /&gt;
			recordStart		:false,&lt;br /&gt;
			showMin			:false,&lt;br /&gt;
			showMax			:false&lt;br /&gt;
		}, options);&lt;br /&gt;
&lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
&lt;br /&gt;
			var $this = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Some classes for the question and subquestions&lt;br /&gt;
			$this.addClass(&#039;vertical-slider-question&#039;);&lt;br /&gt;
			$(&#039;li:[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).addClass(&#039;vertical-slider-subquestion&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through the subquestions&lt;br /&gt;
			$(&#039;li:[id&amp;lt;/div&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).each(function(i){&lt;br /&gt;
				var itemID = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) {&lt;br /&gt;
					opts.startValue = $(&#039;#answer&#039;+itemID).val();&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Insert the slider elements&lt;br /&gt;
				$(&#039;#answer&#039;+itemID).after(&lt;br /&gt;
					&#039;&amp;lt;div class=&amp;quot;vertical-slider-max-min&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-max&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-min&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div id=&amp;quot;vertical-slider-&#039;+itemID+&#039;&amp;quot; class=&amp;quot;vertical-slider&amp;quot; style=&amp;quot;height:&#039;+opts.height+&#039;px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div class=&amp;quot;vertical-slider-callout-wrapper&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-callout&amp;quot; id=&amp;quot;slider-callout-&#039;+itemID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt;&#039;&lt;br /&gt;
				);&lt;br /&gt;
&lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.vertical-slider-max&#039;, $this).text(opts.maxValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.vertical-slider-min&#039;, $this).text(opts.minValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				$(&#039;#vertical-slider-&#039;+itemID).slider({&lt;br /&gt;
					orientation: &#039;vertical&#039;,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					min: opts.minValue,&lt;br /&gt;
					max: opts.maxValue,&lt;br /&gt;
					value: opts.startValue,&lt;br /&gt;
					step: opts.step,&lt;br /&gt;
					slide: function(event, ui) {&lt;br /&gt;
						$(&#039;#answer&#039;+itemID).val(ui.value);&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).text(ui.value);&lt;br /&gt;
						setTimeout(function() {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) }).show();&lt;br /&gt;
						}, 10);&lt;br /&gt;
					},&lt;br /&gt;
					create: function(event, ui) {&lt;br /&gt;
						// Initial values and positions&lt;br /&gt;
						if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) { // Pre-existing answer&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else if(opts.recordStart) { // Record the start value (if option is set)&lt;br /&gt;
							$(&#039;#answer&#039;+itemID).val(opts.startValue);&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).hide();&lt;br /&gt;
						}&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) });&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Vertical slider styles and overrides */&lt;br /&gt;
.vertical-slider-question p.tip {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-subquestion {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 0 3em 0 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question label {&lt;br /&gt;
	display: block;&lt;br /&gt;
	padding: 0 0 0.75em 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question span.input {&lt;br /&gt;
	padding: 0.3em 0 0 0;&lt;br /&gt;
	display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question input.text {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider {&lt;br /&gt;
	float: left;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question .ui-slider-handle {&lt;br /&gt;
	top: auto;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min,&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	position: relative;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	min-width: 3em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min {&lt;br /&gt;
	margin-right: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max,&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	font-size: 0.8em;&lt;br /&gt;
	color:#666666;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max {&lt;br /&gt;
	margin-top: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	right: 0;&lt;br /&gt;
	bottom: 0;&lt;br /&gt;
	margin-bottom: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	top: auto;&lt;br /&gt;
	margin: 0 0 -0.6em 0.5em;&lt;br /&gt;
	padding: 0.1em;&lt;br /&gt;
	font-size: 0.9em;&lt;br /&gt;
	color:#000000;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	background: #F8F8FF;&lt;br /&gt;
	border: 1px solid #D2E0F2;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Range Slider=&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert a jQuery UI range slider into a multi-numeric question and automatically populate that question&#039;s inputs with the range min and max values.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039;: [[Media:Demo_Range_Slider_2.5x.zip|Sample Template and Survey.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_Range_Slider_2.5x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin handles:&lt;br /&gt;
*previous answers&lt;br /&gt;
*slider max/min&lt;br /&gt;
*range min start&lt;br /&gt;
*range max start&lt;br /&gt;
*range span min&lt;br /&gt;
*slider step&lt;br /&gt;
*record the start values&lt;br /&gt;
*show slider max and min&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;LimeSurvey 2.5x&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A multiple-numeric question with two subquestions&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create your multi-numeric question. Do NOT use any of the slider advanced settings.&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A jQuery plugin to display a range slider in LimeSurvey&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.lsRangeSlider = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:100, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:&#039;&#039;, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:&#039;&#039;, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:false, // Record the start value? (default no)&lt;br /&gt;
			showMin			:false, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:false // Show slider maximum value? (default no)&lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
 &lt;br /&gt;
			if($(this).hasClass(&#039;numeric-multi&#039;) &amp;amp;&amp;amp; $(&#039;input.text&#039;, this).length == 2) {&lt;br /&gt;
 &lt;br /&gt;
				// Define some vars	&lt;br /&gt;
				var thisQuestion = $(this);&lt;br /&gt;
				var rangeMinInput = $(&#039;input.text.form-control:eq(0)&#039;, thisQuestion); &lt;br /&gt;
				var rangeMaxInput = $(&#039;input.text.form-control:eq(1)&#039;, thisQuestion); &lt;br /&gt;
				thisQuestion.addClass(&#039;range-slider-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() != &#039;&#039;) {&lt;br /&gt;
					opts.rangeStartMin = $(rangeMinInput).val();&lt;br /&gt;
					opts.rangeStartMax = $(rangeMaxInput).val();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					if(opts.rangeStartMin == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMin = opts.sliderMin;&lt;br /&gt;
					}&lt;br /&gt;
					if(opts.rangeStartMax == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMax = opts.sliderMax;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
		&lt;br /&gt;
				// Insert the slider&lt;br /&gt;
				var insertedEls = &#039;&amp;lt;div class=&amp;quot;col-xs-12 col-sm-12 withslider&amp;quot;&amp;gt;\&lt;br /&gt;
										&amp;lt;input class=&amp;quot;inserted-slider&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;rangeSlider&amp;quot; /&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-left&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-min&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-right&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-max&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;].form-control:eq(0)&#039;, thisQuestion).closest(&#039;.subquestion-list&#039;).hide().before(insertedEls);&lt;br /&gt;
				&lt;br /&gt;
				var sliderValues = [Number(opts.rangeStartMin), Number(opts.rangeStartMax)];&lt;br /&gt;
			&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: Number(opts.sliderMin),&lt;br /&gt;
					&#039;max&#039;: Number(opts.sliderMax),&lt;br /&gt;
					&#039;step&#039;: Number(opts.step),&lt;br /&gt;
					&#039;range&#039;: true,&lt;br /&gt;
					&#039;value&#039;: sliderValues,&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider .tooltip&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
						&lt;br /&gt;
				// Listener on the range slider&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slideStart&#039;, function(event, ui) {&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slide slideStop&#039;, function(event, ui) {&lt;br /&gt;
					var thisLowerVal = Number($.trim($(this).val().split(&#039;,&#039;)[0]));&lt;br /&gt;
					var thisUpperVal = Number($.trim($(this).val().split(&#039;,&#039;)[1]));&lt;br /&gt;
					if(opts.minRangeSpan &amp;gt; 0 &amp;amp;&amp;amp; (thisUpperVal-thisLowerVal) &amp;lt; opts.minRangeSpan) {&lt;br /&gt;
						$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider(&#039;setValue&#039;, sliderValues);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(thisLowerVal);&lt;br /&gt;
						$(rangeMaxInput).val(thisUpperVal);&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
						sliderValues = [thisLowerVal, thisUpperVal];&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
 &lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.inserted-slider-min&#039;, thisQuestion).text(opts.sliderMin);&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.inserted-slider-max&#039;, thisQuestion).text(opts.sliderMax);&lt;br /&gt;
				}&lt;br /&gt;
				&lt;br /&gt;
				// Handle recordStart&lt;br /&gt;
				if(opts.recordStart) {&lt;br /&gt;
					if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[0])));&lt;br /&gt;
						$(rangeMaxInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[1])));&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider({&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:10, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:2, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:8, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:true, // Record the start value? (default no)&lt;br /&gt;
			showMin			:true, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:true // Show slider maximum value? (default no)&lt;br /&gt;
		});&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Or, to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider();&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Reverse Slider=&lt;br /&gt;
&lt;br /&gt;
{{Box|The reverse slider feature can be used in any (multiple) numerical input question type. For more details, please check the [[Question_type_-_Multiple_numerical_input#Slider|slider wiki subsection]].}}&lt;br /&gt;
&lt;br /&gt;
=Sliders With Control Buttons=&lt;br /&gt;
== Version 2.05 ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 7-10, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert &amp;quot;up&amp;quot; and &amp;quot;down&amp;quot; buttons to control sliders. You can download a sample template here - [[Media:Demo_Slider_Buttons.zip|slider with buttons template]] - and a sample survey here - [[Media:Limesurvey_survey_button_slider.lss|button slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:Button_slider.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin allows the following options:&lt;br /&gt;
*Down Text: Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
*Up Text: Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
*Scrolling: Continuous slider movement if the left mouse button is held down&lt;br /&gt;
*Scroll Interval: Interval (in milliseconds) between slider movement when button is held down (do not make this too short or it will be difficult to stop the slider accurately)&lt;br /&gt;
*Value Prefix: Prefix for call-out&lt;br /&gt;
*Value Suffix: Suffix for call-out&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A custom plugin to add control buttons to LimeSurvey sliders&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.sliderButtons = function(options) {&lt;br /&gt;
	&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
		downText: &#039;-&#039;,		// Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
		upText: &#039;+&#039;,		// Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
		scrolling: true,	// Continuous slider movement if left mouse button held down&lt;br /&gt;
		scrollInterval: 150,// Interval (in ms) between slider movement when button is held down&lt;br /&gt;
		valuePrefix: &#039;&#039;,	// Prefix for callout&lt;br /&gt;
		valueSuffix: &#039;&#039;	// Suffix for callout&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function(i) {&lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
	&lt;br /&gt;
			// Add some classes&lt;br /&gt;
			$(thisQuestion).addClass(&#039;slider-button-question&#039;);		&lt;br /&gt;
			&lt;br /&gt;
			// Insert the buttons&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;slider-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button down&amp;quot;&amp;gt;&#039;+opts.downText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button up&amp;quot;&amp;gt;&#039;+opts.upText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
														&amp;lt;/div&amp;gt;&#039;);			&lt;br /&gt;
			&lt;br /&gt;
			// Initial button states&lt;br /&gt;
			function handleButtonState(slider) {&lt;br /&gt;
				var thisRow = $(slider).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSliderVal = $(slider).slider(&#039;option&#039;, &#039;value&#039;);&lt;br /&gt;
				var thisSliderStep = $(slider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var thisSliderMin = $(slider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(slider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisRow).prop(&#039;disabled&#039;, false);&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMin) {&lt;br /&gt;
					$(&#039;button.slider-button.down&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMax) {&lt;br /&gt;
					$(&#039;button.slider-button.up&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				handleButtonState(this);	&lt;br /&gt;
				if($(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val() != &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider-callout&#039;, this).text(opts.valuePrefix+$(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val()+opts.valueSuffix);&lt;br /&gt;
				}&lt;br /&gt;
			});	&lt;br /&gt;
			&lt;br /&gt;
			// Function to handle button actions&lt;br /&gt;
			function handleButtons(thisButton) {&lt;br /&gt;
				var thisRow = $(thisButton).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSlider = $(&#039;.multinum-slider&#039;, thisRow);&lt;br /&gt;
				var thisSliderStep = $(thisSlider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var stepDecimals = 0;&lt;br /&gt;
				if(thisSliderStep.toString().indexOf(&#039;.&#039;) &amp;gt;= 0) {&lt;br /&gt;
					stepDecimals = thisSliderStep.toString().split(&#039;.&#039;)[1].length;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSliderVal = Number($(thisSlider).slider(&#039;option&#039;, &#039;value&#039;)).toFixed(stepDecimals);&lt;br /&gt;
				var thisSliderMin = $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;down&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;gt; thisSliderMin) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)-Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;up&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;lt; thisSliderMax) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)+Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				var newValue = $(thisSlider).slider(&#039;option&#039;, &#039;value&#039;).toFixed(stepDecimals).replace(/\./, LSvar.sLEMradix);&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(newValue).triggerHandler(&#039;keyup&#039;);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisSlider).text(opts.valuePrefix+newValue+opts.valueSuffix);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Scrolling&lt;br /&gt;
			if(opts.scrolling == true) {&lt;br /&gt;
					&lt;br /&gt;
				var sliderTimeout;&lt;br /&gt;
				var clicker = $(&#039;button.slider-button&#039;, thisQuestion);&lt;br /&gt;
				var count = 0;&lt;br /&gt;
&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mousedown(function(){&lt;br /&gt;
					var thisButton = $(this);&lt;br /&gt;
					sliderTimeout = setInterval(function(){&lt;br /&gt;
						handleButtons(thisButton);&lt;br /&gt;
					}, opts.scrollInterval);				&lt;br /&gt;
					return false;&lt;br /&gt;
				});				&lt;br /&gt;
				&lt;br /&gt;
				$(document).mouseup(function(){&lt;br /&gt;
					clearInterval(sliderTimeout);&lt;br /&gt;
					return false;&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mouseout(function(){&lt;br /&gt;
					handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Listener on the buttons&lt;br /&gt;
			$(&#039;button.slider-button&#039;, thisQuestion).click(function(e) {&lt;br /&gt;
				handleButtons(this)	;		&lt;br /&gt;
				handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on sliders&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function( event, ui ) {&lt;br /&gt;
				handleButtonState(this);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on reset buttons&lt;br /&gt;
			$(&#039;.slider-reset&#039;, thisQuestion).on( &amp;quot;click&amp;quot;, function( event, ui ) {&lt;br /&gt;
				var thisReset = $(this);&lt;br /&gt;
				setTimeout(function() {&lt;br /&gt;
					handleButtonState($(thisReset).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				}, 150);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template but easily modified for others):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.slider-button-question label.slider-label {&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    padding: 40px 1em 0 0;&lt;br /&gt;
    *padding: 25px 1em 0 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question div.multinum-slider {&lt;br /&gt;
	margin-top: 45px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .ui-slider-horizontal .ui-slider-handle {&lt;br /&gt;
	width: 18px;&lt;br /&gt;
    margin-left: -9px;&lt;br /&gt;
    top: -4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider_callout {&lt;br /&gt;
    margin-left: -41px;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
    width: 100px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 40px 0 0 25px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button {&lt;br /&gt;
	padding: 0 10px;&lt;br /&gt;
	margin: 0 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button:disabled {&lt;br /&gt;
	opacity:0.65;&lt;br /&gt;
	filter:alpha(opacity=65);&lt;br /&gt;
	cursor: default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-reset {&lt;br /&gt;
	margin-top: 42px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons({&lt;br /&gt;
			downText: &#039;Down&#039;, // Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
			upText: &#039;Up&#039;, // Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
			scrolling: true, // Continuous slider movement if left mouse button held down&lt;br /&gt;
			scrollInterval: 250, // Interval (in ms) between slider movement when button is held down&lt;br /&gt;
			valueSuffix: &amp;quot;%&amp;quot;	// Suffix for callout&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Or, simply to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons();&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Slider Control Buttons for LimeSurvey 3.x can be found here - https://github.com/tpartner/LimeSurvey-Slider-Controls-3x&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176529</id>
		<title>Workarounds: Question design, layout and templating</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=176529"/>
		<updated>2023-05-11T17:28:32Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Star Rating System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This section more or less deals with styling your survey, adjusting the layout and setting up special question types. You can find &#039;&#039;&#039;similar information&#039;&#039;&#039; at these pages:&lt;br /&gt;
* [[The template editor]]&lt;br /&gt;
* [[Workarounds: Manipulating a survey at runtime using Javascript]]&lt;br /&gt;
* [[Workarounds: Survey behaviour]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves. &amp;lt;span style=&#039;color:#EE0000&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Different progress indicator=&lt;br /&gt;
&lt;br /&gt;
==Version 1.87 and later:==&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will find the progress value and insert it into the element following the progress bar.&lt;br /&gt;
&lt;br /&gt;
It should be pointed out that I had to introduce a delay in firing the function because the progress value is not calculated until after template.js is called. The delay is set at 1/10 of a second but you may be able to reduce that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // Display progress value&lt;br /&gt;
&lt;br /&gt;
   function setProgValue() {&lt;br /&gt;
&lt;br /&gt;
       var progress = $(&#039;#progressbar&#039;).attr(&#039;aria-valuenow&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).text(progress+&#039;%&#039;).show();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
       setTimeout(&#039;setProgValue()&#039;,100);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to hide the &amp;quot;0%&amp;quot; before the progress bar, add the following to the end of template.css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
#progress-pre {&lt;br /&gt;
&lt;br /&gt;
   display: none;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Delete unwanted gaps in question title=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When copying data (questions, answers, ...) from MS Word or other applications into the editor there might occur some gaps in the question title.&lt;br /&gt;
&lt;br /&gt;
There are two solutions to this:&lt;br /&gt;
# Use popup mode and manually delete unwanting extra html tags (requires html knowledge).&lt;br /&gt;
# Disable paste word feature: Tweak your limesurvey-config.js file in limesurvey/admin/scripts/fckeditor.26 and set the following option to true:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;FCKConfig.ForcePasteAsPlainText = true ;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that clear you browser cache and try again.&lt;br /&gt;
&lt;br /&gt;
=How to change the &amp;lt;font-size&amp;gt; tags using CSS=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This workaround was deleted because it is outdated. Such changes can be done by [[The template editor#Styling questions with CSS|adjusting template.css]] of your template.&lt;br /&gt;
&lt;br /&gt;
=Question type variation: Scale with bars (one and two sided)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some methodogical issues to think about: Very often a common scale as 1 to 5 or -2 to +2 fits all needs, as the shown subject is clearly defined as positive or negative. As soon as you would reduce the influence from the question and scale on the respondent, you will need something neutral to determine tendences, emphases and so on.&lt;br /&gt;
&lt;br /&gt;
So I put up a new variation of the one and two sided array question:&lt;br /&gt;
&lt;br /&gt;
ttp://www.limesurvey.org/images/fbfiles/images/example_bar_scale.jpg&lt;br /&gt;
&lt;br /&gt;
In my example the left side reads &amp;quot;strategical planning&amp;quot; and the right side &amp;quot;operative business&amp;quot;. None of these are purely negative or positive, so the bars only show in which direction the balancing point moves.&lt;br /&gt;
&lt;br /&gt;
To realize a question as shown above just do as follows:&lt;br /&gt;
&lt;br /&gt;
Set up as many bars as you will need (in my example there are four different bars in total) with a graphic program like PAINT .NET, GIMP or similar ones (yes, you may also use commercial software like Photoshop). To prevent the bars from looking twitchy, designate the size in advance. I did one bar 60x15 px, one 45x15px, one 30x15px and at last 15x15px. Save them as PNG, JPG or GIF.&lt;br /&gt;
# Create a new label set within Lime. Call it whatever you like.&lt;br /&gt;
# Enter a code number at first, then press the pencil symbol to enter the editor.&lt;br /&gt;
#Press the &amp;quot;Insert / edit image&amp;quot; button and upload the bar you want to insert with the FCK upload tool. Then choose the uploaded picture, save and leave the FCK editor.&lt;br /&gt;
#The row in the lable editor now shows an &amp;lt;img&amp;gt;-tag which refers to your bar picture.&lt;br /&gt;
#Repeat the above described steps as often as needed to build up your bar scale.&lt;br /&gt;
&lt;br /&gt;
=Doing a Likert Scale=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A Likert Scale is a special type of the Semantic Differential question where several item shall be rated on different scales, each marked at the beginning and at the end with opposite statements. &lt;br /&gt;
&lt;br /&gt;
To do this in LimeSurvey just follow these steps:&lt;br /&gt;
#Create a label set with values from 0 to 7 (for the classic Likert Scale - feel free to choose other ranges).&lt;br /&gt;
#Create a new question and choose Array (Flexible Labels) as question type.&lt;br /&gt;
#Assign the Likert Scale label set to this question.&lt;br /&gt;
#Enter your answers as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;DIV style=&amp;quot;white-space: nowrap;&amp;quot;&amp;gt;ITEM statement1|statement2&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The white-space style is to avoid line breaks which would ruin the whole scale. feel free to insert non-breakable spaces between the ITEM and statement1 to define the margin between these to strings.&lt;br /&gt;
&lt;br /&gt;
=Alternate background colour of questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To alternate the background colour of questions, open the &#039;&#039;template.css&#039;&#039; of your template with the Template Editor or a text editor and modify the &#039;&#039;Question styles&#039;&#039; section to include the following style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
div#question2 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question4 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question6 td.questiontext {&lt;br /&gt;
&lt;br /&gt;
   background-color: #E0EBF8;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to apply the style to all of the questions you would like modified using their question IDs (&#039;&#039;question2, question4, question6&#039;&#039; in this case). Question IDs are displayed when creating or editing questions - see below:&lt;br /&gt;
&lt;br /&gt;
[[File:qid_1_493x173.gif]]&lt;br /&gt;
&lt;br /&gt;
Here the question ID is #question80 .&lt;br /&gt;
&lt;br /&gt;
=Embedding audio in questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191), IE 7, FireFox 3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Audio clips can be embedded in most question text or answer text. In this example, using the default template, I&#039;ve embedded clips into the answers of an &#039;&#039;&#039;&#039;&#039;Array (Yes/No/Uncertain)&#039;&#039;&#039;&#039;&#039; question to ask respondents how they feel about some sounds. The resulting question will look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x202.gif]]&lt;br /&gt;
&lt;br /&gt;
It&#039;s accomplished by placing the following code in each of the answers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;embed height=&amp;quot;20&amp;quot; width=&amp;quot;128&amp;quot; autostart=&amp;quot;false&amp;quot; controls=&amp;quot;console&amp;quot;&lt;br /&gt;
&lt;br /&gt;
loop=&amp;quot;true&amp;quot; volume=&amp;quot;50&amp;quot; src=&amp;quot;{TEMPLATEURL}audio_1.mp3&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some notes about the code:&lt;br /&gt;
*The &#039;&#039;audio_1.mp3&#039;&#039; part will be different for each answer (it&#039;s the audio file name).&lt;br /&gt;
*In this case the audio files are residing in the template folder being used for this survey (that&#039;s where &#039;&#039;{TEMPLATEURL}&#039;&#039; points to) but they can be placed anywhere if you use an absolute URL in the &#039;&#039;src&#039;&#039; parameter - something like &#039;&#039;src=&amp;quot;http://mysite.com/audio/audio_1.mp3&amp;quot;&#039;&#039;&lt;br /&gt;
*If the audio file doesn&#039;t exist where the &#039;&#039;src&#039;&#039; parameter indicates, the player will not appear.&lt;br /&gt;
*You&#039;ll need to insert the code into the answers using the source screen - click on &amp;quot;Edit answers&amp;quot;, click the pencil beside the text box, click &amp;quot;Source&amp;quot; in the pop-up, enter the code and save it with the little diskette icon.&lt;br /&gt;
*You may need to turn off the XSS filter - see the documentation for [http://docs.limesurvey.org/tiki-index.php?page=Global+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Security Global settings].&lt;br /&gt;
&lt;br /&gt;
Although the above example places the audio in the answer text of the question, the same principles can be used to place it in the question text itself. Something like this perhaps.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x154.gif]]&lt;br /&gt;
&lt;br /&gt;
=Hiding inputs of a &amp;quot;Multiple options with comments&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
There may be times when you want to hide some of the input boxes of a &#039;&#039;&#039;&#039;&#039;Multiple choice question type with comments&#039;&#039;&#039;&#039;&#039; question as in the image below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:hidden_inputs_541x168.gif]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This can be accomplished with CSS (see [[The template editor#Styling questions with CSS|Styling questions in LimeSurvey 1.8]]). For each input that you want to hide, add the following style to your template.css file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
#answer11111X22X33Acomment {&lt;br /&gt;
   display: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where 11111 is your survey ID, 22 is your group ID, 33 is your question ID and A is the answer code.&lt;br /&gt;
&lt;br /&gt;
Note that you will still see columns for the hidden inputs in your data but they will be empty.&lt;br /&gt;
&lt;br /&gt;
=Multiple question types in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90 - 1.92+, IE 7/8/9, Firefox 13, Safari 5, Chrome 10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Media:limesurvey_survey_62584.lss|Download the sample survey]]&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present multiple question types in what appears to be an array - as depicted in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=62584&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here] (download the sample survey - [[Media:limesurvey_survey_62584.lss|limesurvey_survey_62584.lss]]). This example uses the default template but should be adaptable to any template using divisions for question containers.&lt;br /&gt;
&lt;br /&gt;
[[File:inline_questions_700x228.png]]&lt;br /&gt;
&lt;br /&gt;
Basically what we do is take groups of questions (5 in this case), wrap them in a division and make them line up nicely horizontally and vertically. The width of the survey is also fixed to prevent wrapping issues. We do this with a JavaScript/jQuery function that inserts the necessary wrappers and then modifies styles so everything behaves properly. The top row is 5 boilerplate questions with the &amp;quot;column headers&amp;quot; as question text (the first just has a blank space). The following rows are a boilerplate with the &amp;quot;row headers&amp;quot; followed by 4 assorted questions.&lt;br /&gt;
&lt;br /&gt;
It should be noted that using conditions on these questions may result in unexpected behavior. If a question is hidden by conditions, the question(s) to the right of it will move over to take its place.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Create your questions keeping in mind how they will lay out when grouped into rows (in this example - boilerplate, yes/no, short text, numeric, dropdown, and repeat).&lt;br /&gt;
#In the source of the first boilerplate question add the function below (see [http://manual.limesurvey.org/wiki/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F How to use script]).&lt;br /&gt;
#Modify the number of rows, number of columns and the start placement in the function call (line 6) as required (the example uses 4 rows and 5 columns and the &amp;quot;array&amp;quot; starts with the third question on the page).&lt;br /&gt;
&lt;br /&gt;
The code may look intimidating at first but it&#039;s actually fairly simple. I&#039;ve laid it out as sequentially as possible and purposely used few shortcuts and many comments to make it easier to follow.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
*If you use question types other than boilerplate, short text, list dropdown, numeric or yes-no, you&#039;ll need to add to the last section of code, where it hides the question text and formats the inputs for display this way.&lt;br /&gt;
*Any extra questions on the page should follow this grid of questions, not precede them.&lt;br /&gt;
* If you use boilerplate as question type you should add after:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
the following 2 lines&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
//repair boilerplate questioncells&lt;br /&gt;
$(&#039;div.boilerplate td.questiontext&#039;).parent().show();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Javascript code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the &amp;quot;sideBySide&amp;quot; function with number of rows, columns and start position&lt;br /&gt;
		sideBySide(4, 5, 3);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function sideBySide(rows, columns, startQuestion) {&lt;br /&gt;
&lt;br /&gt;
		/*********** Display multiple questions side by side ***********/&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;div.qRow1&#039;).length == 0) {&lt;br /&gt;
&lt;br /&gt;
			var rowNum = 0;&lt;br /&gt;
			var colNum = 1;&lt;br /&gt;
			var rowList = new Array();&lt;br /&gt;
&lt;br /&gt;
			//////// Add question classes for later use ////////&lt;br /&gt;
&lt;br /&gt;
			// Loop through all questions and add row and column specific classes&lt;br /&gt;
			$(&#039;div[id^=&amp;quot;question&amp;quot;]&#039;).each(function(i) {&lt;br /&gt;
				if(i &amp;gt;= (startQuestion-1) &amp;amp;&amp;amp; rowNum &amp;lt; rows) { // This IF condition only needed if there are questions before or following the &amp;quot;inline&amp;quot; questions&lt;br /&gt;
					$(this).addClass(&#039;qRow&#039;+rowNum+&#039;&#039;).addClass(&#039;qCol&#039;+colNum+&#039;&#039;).addClass(&#039;inlineQuestion&#039;);&lt;br /&gt;
					if(rowNum == 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;columnLabel&#039;);&lt;br /&gt;
					}  &lt;br /&gt;
					if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum == 1) {&lt;br /&gt;
						$(this).addClass(&#039;rowLabel&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;questionCell&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					if(colNum == columns) {&lt;br /&gt;
						rowList.push(&#039;qRow&#039;+rowNum+&#039;&#039;);&lt;br /&gt;
						rowNum++;&lt;br /&gt;
						colNum = 1;&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						colNum++;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).addClass(&#039;normalQuestion&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Survey layout manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Fix the width of the survey&lt;br /&gt;
			$(&#039;table.outerframe&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;900px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Wrap each &amp;quot;row&amp;quot; in a wrapper div&lt;br /&gt;
			$(rowList).each(function(i) {&lt;br /&gt;
				$(&#039;.&#039;+this+&#039;&#039;).wrapAll(&#039;&amp;lt;div id=&amp;quot;inlineWrapper&#039;+i+&#039;&amp;quot; class=&amp;quot;inlineRow&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Style the wrapper divs&lt;br /&gt;
			$(&#039;.inlineRow&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;850px&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0 auto 0 auto&#039;,&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.inlineRow:first&#039; ).css({&lt;br /&gt;
				&#039;margin-top&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get all the questions to sit politely side by side&lt;br /&gt;
			$( &#039;.inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;float&#039;: &#039;left&#039;,&lt;br /&gt;
				&#039;height&#039;:&#039;41px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;-8px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;.inlineQuestion .questionhelp&#039; ).hide();&lt;br /&gt;
			$( &#039;.inlineQuestion .survey-question-help&#039; ).parent().hide();&lt;br /&gt;
		   &lt;br /&gt;
			// A little space under the last row&lt;br /&gt;
			$( &#039;.inlineRow:last .inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Any questions not displayed inline (this is only needed if there are questions following the &amp;quot;inline&amp;quot; questions)&lt;br /&gt;
			$( &#039;.normalQuestion&#039; ).css({&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Column manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Set the column widths - can be set individually if necessary&lt;br /&gt;
			// Must add up to less than 100%&lt;br /&gt;
			$( &#039;.qCol1&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;12%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.qCol2, .qCol3, .qCol4, .qCol5&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;22%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Question manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Hide the answer element in boilerplate questions&lt;br /&gt;
			$( &#039;div.boilerplate td.answer&#039; ).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
			$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Push the question tables to 100%&lt;br /&gt;
			$( &#039;div.inlineRow table&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;100%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get everything to line up nicely vertically&lt;br /&gt;
			$( &#039;.inlineQuestion td.questiontext, .inlineQuestion td.answer p&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Adjust cell heights so everything lines up nicely horizontally&lt;br /&gt;
			$( &#039;.inlineQuestion td.answer, .inlineQuestion td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;35px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;0.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;#inlineWrapper0 .inlineQuestion&#039; ).css({ &#039;height&#039;:&#039;50px&#039; });&lt;br /&gt;
			$( &#039;#inlineWrapper0 td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;50px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Yes-no question styles&lt;br /&gt;
			$( &#039;div.yes-no ul&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;,&lt;br /&gt;
				&#039;font-size&#039;: &#039;90%&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0&#039;,&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;5px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no li&#039; ).css({&lt;br /&gt;
				&#039;padding-right&#039;: &#039;1.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no td.answer&#039; ).css({&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Short-text question styles&lt;br /&gt;
			$( &#039;div.text-short input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Numeric question styles&lt;br /&gt;
			$( &#039;div.numeric input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.numeric p.tip&#039; ).css({&lt;br /&gt;
				&#039;display&#039;: &#039;none&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get rid of the margins around select boxes&lt;br /&gt;
			$( &#039;p.question&#039; ).css({ &#039;margin&#039;:&#039;0&#039; });&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Star Rating System=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://www.fyneworks.com/jquery/star-rating/ jQuery Star Rating Plugin] to display a series of stars that are used to generate a rating value. This value is then passed to either a hidden numeric input question or a hidden list radio question. Both methods are outlined below - use one or both depending on whether you want to use [Assessments|assessments].&lt;br /&gt;
&lt;br /&gt;
The plugin uses a series of radio inputs to generate the stars (more about these below). It allows the use of whole or partial stars as shown in the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x324.png]]&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using Numeric Input Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like your rating data to be collected as a numeric value and don&#039;t want to use [[Assessments|LimeSurvey assessments]] - it&#039;s a little easier to implement. There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en here] (first question).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#[http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
##jquery.MetaData.js&lt;br /&gt;
##jquery.rating.css&lt;br /&gt;
##jquery.rating.js&lt;br /&gt;
##delete.gif&lt;br /&gt;
##star.gif&lt;br /&gt;
#In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a numeric input question and then in the source of the question add as many radio inputs as star segments. For example, if you would like 5 stars, each with half-segments (as in the demo Q1), you would need 10 radio inputs and that would give rating values from 1-10.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q1 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;6&amp;quot; value=&amp;quot;6&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;7&amp;quot; value=&amp;quot;7&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;8&amp;quot; value=&amp;quot;8&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;9&amp;quot; value=&amp;quot;9&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;10&amp;quot; value=&amp;quot;10&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. A note on split stars. The stars in the above example are split in half by the &#039;&#039;{ split:2 }&#039;&#039; metadata. So if you don&#039;t want split stars, your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
7. Finally, in the source of the question add the following function after your inputs. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the numeric input and pass the rating values into it as they are changed. If the rating is canceled the numeric input is nullified. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingNumeric(11111, 22, 1); handleRatingNumeric(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingNumeric (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the numeric input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val();&lt;br /&gt;
&lt;br /&gt;
   if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the numeric question&lt;br /&gt;
&lt;br /&gt;
handleRatingNumeric (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using List (Radio) Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like to use [[Assessments|assessments]]. There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en here] (second question).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
&lt;br /&gt;
2. Set up the template to use custom onload functions. (See the [[Workarounds: Manipulating a survey at runtime using Javascript#Custom onload function|workaround here]])&lt;br /&gt;
&lt;br /&gt;
3. [http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
*jquery.MetaData.js&lt;br /&gt;
*jquery.rating.css&lt;br /&gt;
*jquery.rating.js&lt;br /&gt;
*delete.gif&lt;br /&gt;
*star.gif&lt;br /&gt;
&lt;br /&gt;
4. In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a list (radio) question with the same amount of sequentially numbered answers as star ratings. For example, if you want 5 whole-stars, you would create 5 answers, as in the image below, and this would give you ratings from 1-5. Note that the &amp;quot;Codes&amp;quot; and &amp;quot;Answers&amp;quot; must be sequential numbers.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x156_v2.png]]&lt;br /&gt;
&lt;br /&gt;
6. In the list (radio) question, set the [[Advanced question settings|hide_tip]] question attribute to 1&lt;br /&gt;
&lt;br /&gt;
7. In the source of the question add as many radio inputs as star segments. So 5 whole-stars (as in the demo Q2), would need 5 radio inputs.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q2 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. A note on split stars. The stars in the above example are whole-stars. If you want them split you need to add metadata to the class - something like &#039;&#039;{ split:2 }&#039;&#039;. So if you want half-stars your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
9. Finally, in the source of the question add the following function after your inputs. (See [http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure;=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ How to use script here])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the question radio buttons and toggle them as the rating values are changed. If the rating is canceled all question inputs are unchecked. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingRadio(11111, 22, 1); handleRatingRadio(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Onload code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingRadio (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the radio input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#question&#039; + qID + &#039; input.radio[checked=true]&#039;).attr(&#039;value&#039;);&lt;br /&gt;
&lt;br /&gt;
   //if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
   if ( rating ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio[value=&#039; + rating + &#039;]&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the radio question&lt;br /&gt;
&lt;br /&gt;
handleRatingRadio (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable column widths in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define all column widths of an array question - as shown in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here]. This example uses the default template shipped with 7557 but should be adaptable to any template.&lt;br /&gt;
&lt;br /&gt;
[[File:array_widths_701x226.gif]]&lt;br /&gt;
&lt;br /&gt;
We use a function to remove all of the widths imposed by the core code and then insert our own.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects documentation here]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Replace all instances of QQ with the question ID.&lt;br /&gt;
#In the third section of code, adjust the widths and add/remove columns as necessary. This example is for an array with a question text column followed by 3 answer columns as shown above.&lt;br /&gt;
#In the final section adjust the question text alignment to your liking&lt;br /&gt;
&lt;br /&gt;
Onload code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // Get rid of all the widths that the API imposes&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question col&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question thead td&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define a width for the question table so we can do so for its children&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Keep this to 95% or less so IE will behave&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question&#039; ).attr(&#039;width&#039;, &#039;95%&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define the column widths&lt;br /&gt;
&lt;br /&gt;
   // Add or remove columns and adjust widths as necessary but widths should add up to 100%&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Columns must be sequentially numbered starting at 0 - eg, td:eq(0), td:eq(1), td:eq(2).....&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th:eq(0)&#039; ).css({ &#039;width&#039;:&#039;10%&#039; }); // Answer text column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(0)&#039; ).css({ &#039;width&#039;:&#039;50%&#039; }); // First answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(1)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Second answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(2)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Third answer column&lt;br /&gt;
&lt;br /&gt;
   // Push the text input widths to 95% of their parent containers&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question input[type=&amp;quot;text&amp;quot;]&#039; ).css({ &#039;width&#039;:&#039;95%&#039; });&lt;br /&gt;
&lt;br /&gt;
   // Align the answer text - feel free to experiment&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th&#039; ).css({&#039;text-align&#039;:&#039;center&#039;});&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use images for radio buttons and checkboxes=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.92/2.0, using IE 9, FireFox 13, Chrome 16, Safari 5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses an adaptation of the jQuery imagetick.js plugin to replace the default radio buttons and checkboxes with images as pictured below:&lt;br /&gt;
&lt;br /&gt;
[[File:images.png]] &lt;br /&gt;
&lt;br /&gt;
This adaptation will work in the following question types:&lt;br /&gt;
*Array&lt;br /&gt;
*Array by column&lt;br /&gt;
*Array dual scale&lt;br /&gt;
*Array (5 point choice)&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
*Array (Increase-Same-Decrease)&lt;br /&gt;
*Array (Yes-No-Uncertain)&lt;br /&gt;
*Gender&lt;br /&gt;
*Yes-No&lt;br /&gt;
*Multiple choice&lt;br /&gt;
*Multiple choice with comments&lt;br /&gt;
*5 point choice&lt;br /&gt;
*List (Radio)&lt;br /&gt;
*List with comment&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey 2.0 and later implementation==&lt;br /&gt;
&lt;br /&gt;
Follow the instructions above with these changes:&lt;br /&gt;
#Download [[Media:Imagetick_lime_v2.1.zip|this modified version of the plugin for 2.0 and up]] instead of the one mentioned above and add all contained files to your template directory.&lt;br /&gt;
#Add these lines to the &amp;lt;head&amp;gt; element in your startpage.pstpl instead of the one above:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}imagetick_lime_2.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}imagetick_lime_2.css&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thanks to Jordan Boesch for the original plugin.&lt;br /&gt;
&lt;br /&gt;
=Changing the position and layout of an individual question using &amp;quot;question code&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (6536)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use this very flexible workaround you first have to apply a minor change to the question.pstpl of the used template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
needs to be changed to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this change won&#039;t change anything in the layout and can be left in the template even if you don&#039;t need this workaround. It&#039;s just a means to have a handle to actually change individual questions.&lt;br /&gt;
&lt;br /&gt;
You can then use a code such as the following in the question text to make question specific format changes. &amp;quot;SAMPLE&amp;quot; needs to be replaced with the concerning question code and javascript has to be allowed ([[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|older versions of limesurvey]], under global settings for newer versions).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.borderTop= &amp;quot;0px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginTop= &amp;quot;-62px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginLeft= &amp;quot;30px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sample code will hide the border at the top of the question, will move the whole question up by 62px and to the right by 30px. Using this workaround you can change a whole a lot of things concerning format and positions of a specific question without changing all the questions. A (German) list of all the allowed options can be found [http://de.selfhtml.org/javascript/objekte/style.htm#style_eigenschaften here].&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
==Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Assign a label set to the question - these will be the labels in the center column.&lt;br /&gt;
#Set the second parameter of the function call to true for randomized rows.&lt;br /&gt;
#Adjust the styles in lines 21-24 as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The script moves the question columns into the MaxDiff configuration and disables the opposing radio element when a selection is made.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
	&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, false);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function maxDiff(qID, randomize) {&lt;br /&gt;
		&lt;br /&gt;
		// Random number between 1 and 2&lt;br /&gt;
		// Math.floor(Math.random() * (max - min + 1)) + min;&lt;br /&gt;
		var randomNum = Math.floor(Math.random() * ((2-1)+1) + 1);&lt;br /&gt;
&lt;br /&gt;
		// Move the columns&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col:eq(1)&#039;).prependTo(&#039;colgroup.col-responses&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list thead tr:eq(0) th:eq(0)&#039;).prependTo(&#039;#question&#039;+qID+&#039; table.question thead tr:eq(0)&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Random rows&lt;br /&gt;
		if(randomize) {&lt;br /&gt;
			var rowsArr = [];&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
				$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
				rowsArr.push(i);&lt;br /&gt;
			});&lt;br /&gt;
			shuffleArray(rowsArr);&lt;br /&gt;
			$(rowsArr).each(function(i){&lt;br /&gt;
				$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody&#039;).append($(&#039;#question&#039;+qID+&#039; tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Style stuff&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col.odd&#039;).css({ &#039;background-color&#039;:&#039;transparent&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody th&#039;).css({ &#039;text-align&#039;:&#039;center&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:even td, #question&#039;+qID+&#039; table.question tbody tr:even th&#039;).css({ &#039;background-color&#039;:&#039;#F1F1F1&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:odd td, #question&#039;+qID+&#039; table.question tbody tr:odd th&#039;).css({ &#039;background-color&#039;:&#039;#FCFCFC&#039; });&lt;br /&gt;
&lt;br /&gt;
		// Prevent clicking twice in the same row&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input.radio&#039;).on(&#039;click&#039;, function () {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio&#039;).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio:checked&#039;).each(function(i) {&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				$(&#039;input.radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function shuffleArray(array) {&lt;br /&gt;
		for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
			var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
			var temp = array[i];&lt;br /&gt;
			array[i] = array[j];&lt;br /&gt;
			array[j] = temp;&lt;br /&gt;
		}&lt;br /&gt;
		return array;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Versions 2.5 and 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:MaxDiff_2.5.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Template.zip|Demo template]]&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Survey.zip|Demo survey]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Add 2 subquestions to the array - these will be the left and right columns.&lt;br /&gt;
#Add answers to the array - these will be the rows.&lt;br /&gt;
#Create a copy the default template.&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.js&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function maxDiff(qID, randomize) {&lt;br /&gt;
 &lt;br /&gt;
	// Identify some elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisTable = $(&#039;table.subquestion-list:eq(0)&#039;, thisQuestion);&lt;br /&gt;
 &lt;br /&gt;
	// Assign a new question class&lt;br /&gt;
	$(thisQuestion).addClass(&#039;max-diff-array&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Move the columns&lt;br /&gt;
	$(&#039;thead tr:eq(0)&#039;, thisTable).prepend($(&#039;thead tr:eq(0) th:eq(1)&#039;, thisTable));&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
		$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Random rows&lt;br /&gt;
	if(randomize) {&lt;br /&gt;
		var rowsArr = [];&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
			$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
			rowsArr.push(i);&lt;br /&gt;
		});&lt;br /&gt;
		shuffleArray(rowsArr);&lt;br /&gt;
		$(rowsArr).each(function(i){&lt;br /&gt;
			$(&#039;tbody&#039;, thisTable).append($(&#039;tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;, thisTable));&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	// Prevent clicking twice in the same row&lt;br /&gt;
	$(&#039;input:radio&#039;, thisQuestion).on(&#039;click&#039;, function () {&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;input:radio&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		$(&#039;input:radio:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr.answers-list&#039;);&lt;br /&gt;
			$(&#039;input:radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		});&lt;br /&gt;
	});	&lt;br /&gt;
 &lt;br /&gt;
	// Fix up the row classes&lt;br /&gt;
	var rowClass = 1;&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i) {&lt;br /&gt;
		$(this).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.css&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.max-diff-array th.answertext { &lt;br /&gt;
	text-align: center;&lt;br /&gt;
	border-right: 3px solid #FFFFFF;&lt;br /&gt;
	border-left: 3px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
/* Override the responsive &amp;quot;no-more-tables&amp;quot; stuff */&lt;br /&gt;
@media only screen and (max-width: 801px) {&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables table {&lt;br /&gt;
		display: table;&lt;br /&gt;
		border-collapse: inherit;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables thead, &lt;br /&gt;
	.max-diff-array .no-more-tables tbody {&lt;br /&gt;
		display: table-row-group;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables tr {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		position: relative;&lt;br /&gt;
		top: auto;&lt;br /&gt;
		display: table-row;&lt;br /&gt;
		border: 0 none;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables th, &lt;br /&gt;
	.max-diff-array .no-more-tables td {&lt;br /&gt;
		display: table-cell;&lt;br /&gt;
		text-align: center !important;&lt;br /&gt;
		color: #2c3e50;&lt;br /&gt;
		font-size: 15px;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array th.answertext { &lt;br /&gt;
		border-right: 3px solid #FFFFFF;&lt;br /&gt;
		border-left: 3px solid #FFFFFF;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .answer-item label span {&lt;br /&gt;
		display: none !important;&lt;br /&gt;
	}	&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add a script like this to the question source of the Array (flexible labels) question:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	   &lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, true);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Load SVG Code From Drawing Tool=&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to load a drawing tool and store the results in a huge-text question. The details are outlined in the [[Workarounds: Manipulating a survey at runtime using Javascript#Load SVG Code From Drawing Tool|JavaScript section of the workarounds]].&lt;br /&gt;
&lt;br /&gt;
=Minimum or Maximum Date in Datepicker=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note: From version 2.05 beta6, you MUST set the minimum and maximum date for the date picker directly in the advanced question attributes of the date/time question. This workaround will seize to work.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can set the minimum or maximum selectible date in a datepicker as follows&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]] and add the following to the source of the date question text or help. Replace &amp;quot;QQ&amp;quot; with the date question ID.&lt;br /&gt;
&lt;br /&gt;
For a minimum date of April 15, 2010:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date(2010, 4-1, 15) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a minimum date of the current date (today):&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date() );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a maximum date of May 10, 2015:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date(2015, 5-1, 10) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More details here - http://jqueryui.com/demos/datepicker/#option-minDate&lt;br /&gt;
&lt;br /&gt;
=Evaluative Space Grid (ESG)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 &amp;amp; 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The evaluative space grid (ESG) is a two-dimensional grid that provides a single-item measure of positivity and negativity (Larsen et al, 2009). See [http://leeds-faculty.colorado.edu/mcgrawp/pdf/larsen.norris.mcgraw.hawkley.cacioppo.2009.pdf page 4 of this PDF].&lt;br /&gt;
&lt;br /&gt;
This can be accomplished using a multiple-numeric question, some simple HTML and a little JavaScript.&lt;br /&gt;
&lt;br /&gt;
A table can be shown in the question. When a respondent clicks a grid cell in the table JavaScript loads the coordinates of the cell into the multiple-numeric question inputs.&lt;br /&gt;
&lt;br /&gt;
[[File:Space_grid_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create a Multiple Numeric question with two subquestions labelled &amp;quot;X&amp;quot; and &amp;quot;Y&amp;quot;.&lt;br /&gt;
#Add the following HTML to the source of the question to create the table:&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;spaceGrid&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td rowspan=&amp;quot;5&amp;quot; class=&amp;quot;yAxisLabel&amp;quot;&amp;gt;How NEGATIVE&amp;lt;br&amp;gt;&lt;br /&gt;
			do you feel about&amp;lt;br&amp;gt;&lt;br /&gt;
		the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td colspan=&amp;quot;5&amp;quot; class=&amp;quot;xAxisLabel&amp;quot;&amp;gt;How POSITIVE do you feel about the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following styles to the end of your template.css file:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.spaceGrid {&lt;br /&gt;
	width: auto;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.spaceGrid td {&lt;br /&gt;
	padding: 0 3px;&lt;br /&gt;
	text-align: center !important;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xAxisLabel {&lt;br /&gt;
	padding-top: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yAxisLabel {&lt;br /&gt;
	padding-right: 10px;&lt;br /&gt;
	width: 125px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xLabel {&lt;br /&gt;
	height: 20px;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yLabel {&lt;br /&gt;
	text-align: right !important;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.gridCell {&lt;br /&gt;
	width: 70px;&lt;br /&gt;
	height: 70px;&lt;br /&gt;
	border: 1px solid #666666;&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.checkedCell {&lt;br /&gt;
	background-color: #66FF00;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of your template.js file:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;	&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
	$(&#039;.spaceGrid&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
		// Define some vars&lt;br /&gt;
		var thisQuestion = $(this).closest(&#039;.numeric-multi&#039;);&lt;br /&gt;
		var thisTable = $(this).closest(&#039;table.spaceGrid&#039;);&lt;br /&gt;
		var numGridCell = $(&#039;.gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numCols = $(&#039;tr:eq(0) .gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numRows = numGridCell/numCols;&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers list&lt;br /&gt;
		$(&#039;.subquestion-list, .questions-list&#039;, thisQuestion).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Initial state&lt;br /&gt;
		var xCoord = $(&#039;input.text:eq(0)&#039;, thisQuestion).val() - 1;&lt;br /&gt;
		var yCoord = numRows - $(&#039;input.text:eq(1)&#039;, thisQuestion).val();&lt;br /&gt;
		$(&#039;tr:eq(&#039;+yCoord+&#039;) .gridCell:eq(&#039;+xCoord+&#039;)&#039;, thisTable).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the grid cells&lt;br /&gt;
		$(&#039;.gridCell&#039;).click(function(){&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Add class to checked cell&lt;br /&gt;
			$(&#039;.checkedCell&#039;, thisQuestion).removeClass(&#039;checkedCell&#039;);&lt;br /&gt;
			$(this).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Find the cell coordinates&lt;br /&gt;
			var reverseRowIndex = (numRows - $(&#039;tr&#039;, thisTable).index($(thisRow)));&lt;br /&gt;
			var colIndex = $(&#039;.gridCell&#039;, thisRow).index($(this)) + 1;&lt;br /&gt;
	&lt;br /&gt;
			// Load coordinates into inputs&lt;br /&gt;
			$(&#039;input.text:eq(0)&#039;, thisQuestion).val(colIndex);&lt;br /&gt;
			$(&#039;input.text:eq(1)&#039;, thisQuestion).val(reverseRowIndex);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The script should automatically handle different grid sizes.&lt;br /&gt;
&lt;br /&gt;
=Slider Highlighting=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may want to highlight a slider after it has been moved/changed to allow respondents to easily see which slider subquestions have been answered.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture.PNG]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;template.js&#039;&#039;&#039;:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(&#039;html&#039;).bind(&#039;slidecreate&#039;, function(event, ui) {&lt;br /&gt;
	$(&#039;.slider_callout&#039;).each(function(i){&lt;br /&gt;
		if($(this).text().length &amp;gt; 0) {&lt;br /&gt;
			$(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	$(&#039;.ui-slider-horizontal&#039;).bind(&#039;slidechange&#039;, function(event, ui) {&lt;br /&gt;
	 $(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and would need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.numeric-multi .answer li {&lt;br /&gt;
	border-bottom: 5px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li label {&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li div.multinum-slider {&lt;br /&gt;
	margin: 1.5em 0.5em 0.2em 0;&lt;br /&gt;
	padding-left: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ui-slider-1 {&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.changedSlider {&lt;br /&gt;
	background-color: #99FFFF;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Dynamic Slider Call-Out Styles=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 9-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is an example of how to insert a custom &#039;&#039;&#039;&#039;&#039;slide()&#039;&#039;&#039;&#039;&#039; function to control the appearance of the slider call-out as the slider is manipulated. In this example the call-out text colour changes as the slider is moved. Sample survey here - [[Media:Dynamic_slider_call_out.lss|dynamic call-out slider survey]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Dynamic_slider_call_out.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
 &lt;br /&gt;
		// Slide function&lt;br /&gt;
		$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function( event, ui ) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), ui.value);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Initial callout states&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), $(this).val());&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Handle the callout style&lt;br /&gt;
		function handleCallout(thisRow, sliderVal) {&lt;br /&gt;
			if(sliderVal &amp;lt; 20) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D90000&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 40) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D96D00&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 60) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D9D900&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#00B22D&#039;);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sliders in Array-Numbers or Array-Dual-Scale-Numbers=&lt;br /&gt;
&lt;br /&gt;
This workaround will replace the dropdowns in &#039;&#039;&#039;&#039;&#039;array-numbers&#039;&#039;&#039;&#039;&#039; or &#039;&#039;&#039;&#039;&#039;array-dual-scale-numbers&#039;&#039;&#039;&#039;&#039; questions with sliders. The sliders will automatically have the same minimum, maximum and steps that you set in the advanced question settings.&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.06==&lt;br /&gt;
[[File:custom_sliders_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; select&#039;).each(function(i, el){&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				var id = $(el).attr(&#039;id&#039;).replace(/#/g,&#039;-&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = Number($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).val());&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).next(&#039;option&#039;).val());&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Insert a container for the slider&lt;br /&gt;
				var container = $(&#039;&amp;lt;div class=&amp;quot;customSliderWrapper&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				var slider = $(&#039;&amp;lt;div id=&amp;quot;slider-&#039;+id+&#039;&amp;quot; class=&amp;quot;customSlider&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo(container).slider({&lt;br /&gt;
					min: firstVal,&lt;br /&gt;
					max: lastVal,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					value: currentVal,&lt;br /&gt;
					step: secondVal - firstVal,&lt;br /&gt;
					slide: function( event, ui ) {&lt;br /&gt;
						$(el).val(ui.value);&lt;br /&gt;
						$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
&lt;br /&gt;
				// Insert a callout&lt;br /&gt;
				var callout = $(&#039;&amp;lt;div id=&amp;quot;callOut-&#039;+id+&#039;&amp;quot; class=&amp;quot;slider_callout slider-callout&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo($(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;)).text($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Set a value as soon as the slider handle is clicked&lt;br /&gt;
				$(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;).mousedown(function() {&lt;br /&gt;
					$(el).val(slider.slider(&#039;value&#039;));&lt;br /&gt;
					$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.customSliderWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 10px;&lt;br /&gt;
	padding-top: 1.75em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey Version 2.6x==&lt;br /&gt;
[[File:Dropdown-sliders.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.64.7 &#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
			&lt;br /&gt;
			// Identify this question&lt;br /&gt;
			var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
			thisQuestion.addClass(&#039;with-dropdown-sliders&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through all array drop-downs&lt;br /&gt;
			$(&#039;select.multiflexiselect&#039;, thisQuestion).each(function(i, el){&lt;br /&gt;
				var thisCell = $(el).closest(&#039;td&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = $(el).val();&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:eq(1)&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
&lt;br /&gt;
				// Insert an input for the slider&lt;br /&gt;
				var thisInput = $(&#039;&amp;lt;input class=&amp;quot;inserted-input&amp;quot; type=&amp;quot;text&amp;quot; /&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
				&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				thisInput.val(currentVal).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: firstVal,&lt;br /&gt;
					&#039;max&#039;: lastVal,&lt;br /&gt;
					&#039;step&#039;: secondVal - firstVal,&lt;br /&gt;
					&#039;value&#039;: Number(currentVal),&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Listener on the slider&lt;br /&gt;
				$(thisInput).on(&#039;slideStop&#039;, function () {&lt;br /&gt;
					if($(&#039;.tooltip&#039;, thisCell).is(&#039;:hidden&#039;)) {&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).show();&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).css(&#039;margin-left&#039;, &#039;-&#039;+($(&#039;.tooltip&#039;, thisCell).width()/2)+&#039;px&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(el).val($(thisInput).val());&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Hide the slider call-out if no value selected yet&lt;br /&gt;
				if(currentVal == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.tooltip&#039;, thisCell).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal {&lt;br /&gt;
    margin: 1.5em auto  1em auto;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey for version 2.6x: [[Media:Demo_Sliders_in_Array_Survey.zip|Demo_Sliders_in_Array_Survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Vertical Sliders=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, 2.00+, IE 9, Firefox 13, Chrome 19&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to apply vertical sliders to multiple-numeric questions. You can download a sample template here (with the plugin in template.js) - [[Media:default_vertical_sliders.zip|vertical slider template]] - and a sample survey here - [[Media:demo_vertical_sliders.lss|vertical slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:verticalsliders_1.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question(s). Do NOT use any of the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js. Replace &amp;quot;QQ&amp;quot; (line 5) with the question ID and adjust the options in the function call as desired. Repeat the call as many times as you need for more questions&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
	// Call the vertical slider plugin with the question ID&lt;br /&gt;
	// Edit options here as desired&lt;br /&gt;
	$(&#039;#questionQQ&#039;).lsVerticalSlider({&lt;br /&gt;
		minValue		:0,		// Minimum value (default 0)&lt;br /&gt;
		maxValue		:200,	// Maximum value (default 100)&lt;br /&gt;
		startValue		:100,	// Start value (default null)&lt;br /&gt;
		step			:10,	// Slider increments (default 1)&lt;br /&gt;
		height			:100,	// Height of slider in pixels (default 200)&lt;br /&gt;
		recordStart		:true,	// Record the start value? (default no)&lt;br /&gt;
		showMin			:true,	// Show minimum value? (default no)&lt;br /&gt;
		showMax			:true	// Show maximum value? (default no)&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
// NO EDITING REQUIRED BELOW HERE&lt;br /&gt;
// A jQuery plugin to convert multiple-numeric questions to vertical sliders&lt;br /&gt;
(function( $ ){&lt;br /&gt;
	$.fn.lsVerticalSlider = function(options) {&lt;br /&gt;
&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			minValue		:0,&lt;br /&gt;
			maxValue		:100,&lt;br /&gt;
			startValue		:&#039;&#039;,&lt;br /&gt;
			step			:1,&lt;br /&gt;
			height			:150,&lt;br /&gt;
			recordStart		:false,&lt;br /&gt;
			showMin			:false,&lt;br /&gt;
			showMax			:false&lt;br /&gt;
		}, options);&lt;br /&gt;
&lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
&lt;br /&gt;
			var $this = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Some classes for the question and subquestions&lt;br /&gt;
			$this.addClass(&#039;vertical-slider-question&#039;);&lt;br /&gt;
			$(&#039;li:[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).addClass(&#039;vertical-slider-subquestion&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through the subquestions&lt;br /&gt;
			$(&#039;li:[id&amp;lt;/div&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).each(function(i){&lt;br /&gt;
				var itemID = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) {&lt;br /&gt;
					opts.startValue = $(&#039;#answer&#039;+itemID).val();&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Insert the slider elements&lt;br /&gt;
				$(&#039;#answer&#039;+itemID).after(&lt;br /&gt;
					&#039;&amp;lt;div class=&amp;quot;vertical-slider-max-min&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-max&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-min&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div id=&amp;quot;vertical-slider-&#039;+itemID+&#039;&amp;quot; class=&amp;quot;vertical-slider&amp;quot; style=&amp;quot;height:&#039;+opts.height+&#039;px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div class=&amp;quot;vertical-slider-callout-wrapper&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-callout&amp;quot; id=&amp;quot;slider-callout-&#039;+itemID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt;&#039;&lt;br /&gt;
				);&lt;br /&gt;
&lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.vertical-slider-max&#039;, $this).text(opts.maxValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.vertical-slider-min&#039;, $this).text(opts.minValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				$(&#039;#vertical-slider-&#039;+itemID).slider({&lt;br /&gt;
					orientation: &#039;vertical&#039;,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					min: opts.minValue,&lt;br /&gt;
					max: opts.maxValue,&lt;br /&gt;
					value: opts.startValue,&lt;br /&gt;
					step: opts.step,&lt;br /&gt;
					slide: function(event, ui) {&lt;br /&gt;
						$(&#039;#answer&#039;+itemID).val(ui.value);&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).text(ui.value);&lt;br /&gt;
						setTimeout(function() {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) }).show();&lt;br /&gt;
						}, 10);&lt;br /&gt;
					},&lt;br /&gt;
					create: function(event, ui) {&lt;br /&gt;
						// Initial values and positions&lt;br /&gt;
						if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) { // Pre-existing answer&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else if(opts.recordStart) { // Record the start value (if option is set)&lt;br /&gt;
							$(&#039;#answer&#039;+itemID).val(opts.startValue);&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).hide();&lt;br /&gt;
						}&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) });&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Vertical slider styles and overrides */&lt;br /&gt;
.vertical-slider-question p.tip {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-subquestion {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 0 3em 0 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question label {&lt;br /&gt;
	display: block;&lt;br /&gt;
	padding: 0 0 0.75em 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question span.input {&lt;br /&gt;
	padding: 0.3em 0 0 0;&lt;br /&gt;
	display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question input.text {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider {&lt;br /&gt;
	float: left;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question .ui-slider-handle {&lt;br /&gt;
	top: auto;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min,&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	position: relative;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	min-width: 3em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min {&lt;br /&gt;
	margin-right: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max,&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	font-size: 0.8em;&lt;br /&gt;
	color:#666666;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max {&lt;br /&gt;
	margin-top: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	right: 0;&lt;br /&gt;
	bottom: 0;&lt;br /&gt;
	margin-bottom: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	top: auto;&lt;br /&gt;
	margin: 0 0 -0.6em 0.5em;&lt;br /&gt;
	padding: 0.1em;&lt;br /&gt;
	font-size: 0.9em;&lt;br /&gt;
	color:#000000;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	background: #F8F8FF;&lt;br /&gt;
	border: 1px solid #D2E0F2;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Range Slider=&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert a jQuery UI range slider into a multi-numeric question and automatically populate that question&#039;s inputs with the range min and max values.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039;: [[Media:Demo_Range_Slider_2.5x.zip|Sample Template and Survey.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_Range_Slider_2.5x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin handles:&lt;br /&gt;
*previous answers&lt;br /&gt;
*slider max/min&lt;br /&gt;
*range min start&lt;br /&gt;
*range max start&lt;br /&gt;
*range span min&lt;br /&gt;
*slider step&lt;br /&gt;
*record the start values&lt;br /&gt;
*show slider max and min&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;LimeSurvey 2.5x&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A multiple-numeric question with two subquestions&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create your multi-numeric question. Do NOT use any of the slider advanced settings.&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A jQuery plugin to display a range slider in LimeSurvey&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.lsRangeSlider = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:100, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:&#039;&#039;, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:&#039;&#039;, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:false, // Record the start value? (default no)&lt;br /&gt;
			showMin			:false, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:false // Show slider maximum value? (default no)&lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
 &lt;br /&gt;
			if($(this).hasClass(&#039;numeric-multi&#039;) &amp;amp;&amp;amp; $(&#039;input.text&#039;, this).length == 2) {&lt;br /&gt;
 &lt;br /&gt;
				// Define some vars	&lt;br /&gt;
				var thisQuestion = $(this);&lt;br /&gt;
				var rangeMinInput = $(&#039;input.text.form-control:eq(0)&#039;, thisQuestion); &lt;br /&gt;
				var rangeMaxInput = $(&#039;input.text.form-control:eq(1)&#039;, thisQuestion); &lt;br /&gt;
				thisQuestion.addClass(&#039;range-slider-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() != &#039;&#039;) {&lt;br /&gt;
					opts.rangeStartMin = $(rangeMinInput).val();&lt;br /&gt;
					opts.rangeStartMax = $(rangeMaxInput).val();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					if(opts.rangeStartMin == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMin = opts.sliderMin;&lt;br /&gt;
					}&lt;br /&gt;
					if(opts.rangeStartMax == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMax = opts.sliderMax;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
		&lt;br /&gt;
				// Insert the slider&lt;br /&gt;
				var insertedEls = &#039;&amp;lt;div class=&amp;quot;col-xs-12 col-sm-12 withslider&amp;quot;&amp;gt;\&lt;br /&gt;
										&amp;lt;input class=&amp;quot;inserted-slider&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;rangeSlider&amp;quot; /&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-left&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-min&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-right&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-max&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;].form-control:eq(0)&#039;, thisQuestion).closest(&#039;.subquestion-list&#039;).hide().before(insertedEls);&lt;br /&gt;
				&lt;br /&gt;
				var sliderValues = [Number(opts.rangeStartMin), Number(opts.rangeStartMax)];&lt;br /&gt;
			&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: Number(opts.sliderMin),&lt;br /&gt;
					&#039;max&#039;: Number(opts.sliderMax),&lt;br /&gt;
					&#039;step&#039;: Number(opts.step),&lt;br /&gt;
					&#039;range&#039;: true,&lt;br /&gt;
					&#039;value&#039;: sliderValues,&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider .tooltip&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
						&lt;br /&gt;
				// Listener on the range slider&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slideStart&#039;, function(event, ui) {&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slide slideStop&#039;, function(event, ui) {&lt;br /&gt;
					var thisLowerVal = Number($.trim($(this).val().split(&#039;,&#039;)[0]));&lt;br /&gt;
					var thisUpperVal = Number($.trim($(this).val().split(&#039;,&#039;)[1]));&lt;br /&gt;
					if(opts.minRangeSpan &amp;gt; 0 &amp;amp;&amp;amp; (thisUpperVal-thisLowerVal) &amp;lt; opts.minRangeSpan) {&lt;br /&gt;
						$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider(&#039;setValue&#039;, sliderValues);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(thisLowerVal);&lt;br /&gt;
						$(rangeMaxInput).val(thisUpperVal);&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
						sliderValues = [thisLowerVal, thisUpperVal];&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
 &lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.inserted-slider-min&#039;, thisQuestion).text(opts.sliderMin);&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.inserted-slider-max&#039;, thisQuestion).text(opts.sliderMax);&lt;br /&gt;
				}&lt;br /&gt;
				&lt;br /&gt;
				// Handle recordStart&lt;br /&gt;
				if(opts.recordStart) {&lt;br /&gt;
					if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[0])));&lt;br /&gt;
						$(rangeMaxInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[1])));&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider({&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:10, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:2, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:8, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:true, // Record the start value? (default no)&lt;br /&gt;
			showMin			:true, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:true // Show slider maximum value? (default no)&lt;br /&gt;
		});&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Or, to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider();&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Reverse Slider=&lt;br /&gt;
&lt;br /&gt;
{{Box|The reverse slider feature can be used in any (multiple) numerical input question type. For more details, please check the [[Question_type_-_Multiple_numerical_input#Slider|slider wiki subsection]].}}&lt;br /&gt;
&lt;br /&gt;
=Sliders With Control Buttons=&lt;br /&gt;
== Version 2.05 ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 7-10, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert &amp;quot;up&amp;quot; and &amp;quot;down&amp;quot; buttons to control sliders. You can download a sample template here - [[Media:Demo_Slider_Buttons.zip|slider with buttons template]] - and a sample survey here - [[Media:Limesurvey_survey_button_slider.lss|button slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:Button_slider.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin allows the following options:&lt;br /&gt;
*Down Text: Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
*Up Text: Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
*Scrolling: Continuous slider movement if the left mouse button is held down&lt;br /&gt;
*Scroll Interval: Interval (in milliseconds) between slider movement when button is held down (do not make this too short or it will be difficult to stop the slider accurately)&lt;br /&gt;
*Value Prefix: Prefix for call-out&lt;br /&gt;
*Value Suffix: Suffix for call-out&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A custom plugin to add control buttons to LimeSurvey sliders&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.sliderButtons = function(options) {&lt;br /&gt;
	&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
		downText: &#039;-&#039;,		// Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
		upText: &#039;+&#039;,		// Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
		scrolling: true,	// Continuous slider movement if left mouse button held down&lt;br /&gt;
		scrollInterval: 150,// Interval (in ms) between slider movement when button is held down&lt;br /&gt;
		valuePrefix: &#039;&#039;,	// Prefix for callout&lt;br /&gt;
		valueSuffix: &#039;&#039;	// Suffix for callout&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function(i) {&lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
	&lt;br /&gt;
			// Add some classes&lt;br /&gt;
			$(thisQuestion).addClass(&#039;slider-button-question&#039;);		&lt;br /&gt;
			&lt;br /&gt;
			// Insert the buttons&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;slider-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button down&amp;quot;&amp;gt;&#039;+opts.downText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button up&amp;quot;&amp;gt;&#039;+opts.upText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
														&amp;lt;/div&amp;gt;&#039;);			&lt;br /&gt;
			&lt;br /&gt;
			// Initial button states&lt;br /&gt;
			function handleButtonState(slider) {&lt;br /&gt;
				var thisRow = $(slider).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSliderVal = $(slider).slider(&#039;option&#039;, &#039;value&#039;);&lt;br /&gt;
				var thisSliderStep = $(slider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var thisSliderMin = $(slider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(slider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisRow).prop(&#039;disabled&#039;, false);&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMin) {&lt;br /&gt;
					$(&#039;button.slider-button.down&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMax) {&lt;br /&gt;
					$(&#039;button.slider-button.up&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				handleButtonState(this);	&lt;br /&gt;
				if($(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val() != &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider-callout&#039;, this).text(opts.valuePrefix+$(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val()+opts.valueSuffix);&lt;br /&gt;
				}&lt;br /&gt;
			});	&lt;br /&gt;
			&lt;br /&gt;
			// Function to handle button actions&lt;br /&gt;
			function handleButtons(thisButton) {&lt;br /&gt;
				var thisRow = $(thisButton).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSlider = $(&#039;.multinum-slider&#039;, thisRow);&lt;br /&gt;
				var thisSliderStep = $(thisSlider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var stepDecimals = 0;&lt;br /&gt;
				if(thisSliderStep.toString().indexOf(&#039;.&#039;) &amp;gt;= 0) {&lt;br /&gt;
					stepDecimals = thisSliderStep.toString().split(&#039;.&#039;)[1].length;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSliderVal = Number($(thisSlider).slider(&#039;option&#039;, &#039;value&#039;)).toFixed(stepDecimals);&lt;br /&gt;
				var thisSliderMin = $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;down&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;gt; thisSliderMin) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)-Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;up&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;lt; thisSliderMax) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)+Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				var newValue = $(thisSlider).slider(&#039;option&#039;, &#039;value&#039;).toFixed(stepDecimals).replace(/\./, LSvar.sLEMradix);&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(newValue).triggerHandler(&#039;keyup&#039;);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisSlider).text(opts.valuePrefix+newValue+opts.valueSuffix);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Scrolling&lt;br /&gt;
			if(opts.scrolling == true) {&lt;br /&gt;
					&lt;br /&gt;
				var sliderTimeout;&lt;br /&gt;
				var clicker = $(&#039;button.slider-button&#039;, thisQuestion);&lt;br /&gt;
				var count = 0;&lt;br /&gt;
&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mousedown(function(){&lt;br /&gt;
					var thisButton = $(this);&lt;br /&gt;
					sliderTimeout = setInterval(function(){&lt;br /&gt;
						handleButtons(thisButton);&lt;br /&gt;
					}, opts.scrollInterval);				&lt;br /&gt;
					return false;&lt;br /&gt;
				});				&lt;br /&gt;
				&lt;br /&gt;
				$(document).mouseup(function(){&lt;br /&gt;
					clearInterval(sliderTimeout);&lt;br /&gt;
					return false;&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mouseout(function(){&lt;br /&gt;
					handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Listener on the buttons&lt;br /&gt;
			$(&#039;button.slider-button&#039;, thisQuestion).click(function(e) {&lt;br /&gt;
				handleButtons(this)	;		&lt;br /&gt;
				handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on sliders&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function( event, ui ) {&lt;br /&gt;
				handleButtonState(this);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on reset buttons&lt;br /&gt;
			$(&#039;.slider-reset&#039;, thisQuestion).on( &amp;quot;click&amp;quot;, function( event, ui ) {&lt;br /&gt;
				var thisReset = $(this);&lt;br /&gt;
				setTimeout(function() {&lt;br /&gt;
					handleButtonState($(thisReset).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				}, 150);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template but easily modified for others):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;.slider-button-question label.slider-label {&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    padding: 40px 1em 0 0;&lt;br /&gt;
    *padding: 25px 1em 0 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question div.multinum-slider {&lt;br /&gt;
	margin-top: 45px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .ui-slider-horizontal .ui-slider-handle {&lt;br /&gt;
	width: 18px;&lt;br /&gt;
    margin-left: -9px;&lt;br /&gt;
    top: -4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider_callout {&lt;br /&gt;
    margin-left: -41px;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
    width: 100px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 40px 0 0 25px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button {&lt;br /&gt;
	padding: 0 10px;&lt;br /&gt;
	margin: 0 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button:disabled {&lt;br /&gt;
	opacity:0.65;&lt;br /&gt;
	filter:alpha(opacity=65);&lt;br /&gt;
	cursor: default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-reset {&lt;br /&gt;
	margin-top: 42px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons({&lt;br /&gt;
			downText: &#039;Down&#039;, // Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
			upText: &#039;Up&#039;, // Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
			scrolling: true, // Continuous slider movement if left mouse button held down&lt;br /&gt;
			scrollInterval: 250, // Interval (in ms) between slider movement when button is held down&lt;br /&gt;
			valueSuffix: &amp;quot;%&amp;quot;	// Suffix for callout&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Or, simply to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons();&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Slider Control Buttons for LimeSurvey 3.x can be found here - https://github.com/tpartner/LimeSurvey-Slider-Controls-3x&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176528</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176528"/>
		<updated>2023-05-11T17:27:28Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Partially Randomized Answers - List (dropdown) questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace the ID question at the end of the function call.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the last answer option&lt;br /&gt;
			var ansCount = $( &#039;div#question&#039; + qID + &#039; select option&#039; ).length - 1;&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer option at the end of the list&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; )&lt;br /&gt;
				.appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the qID (replace the qID eg. partRandDD(244)) &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
		//If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
     });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&#039;&#039;Tested with: 3.08 - 3.15&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 4.x==&lt;br /&gt;
&#039;&#039;Tested with: 4.5.1&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:qSort-4.x.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LimeSurvey Version 3.x==&lt;br /&gt;
Here is a custom question theme for LS 3.x - https://github.com/tpartner/LimeSurvey-Social-Value-Orientation&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176527</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176527"/>
		<updated>2023-05-11T17:27:02Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Text input masks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace the ID question at the end of the function call.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the last answer option&lt;br /&gt;
			var ansCount = $( &#039;div#question&#039; + qID + &#039; select option&#039; ).length - 1;&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer option at the end of the list&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; )&lt;br /&gt;
				.appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the qID (replace the qID eg. partRandDD(244)) &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
		//If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
     });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&#039;&#039;Tested with: 3.08 - 3.15&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 4.x==&lt;br /&gt;
&#039;&#039;Tested with: 4.5.1&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:qSort-4.x.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LimeSurvey Version 3.x==&lt;br /&gt;
Here is a custom question theme for LS 3.x - https://github.com/tpartner/LimeSurvey-Social-Value-Orientation&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176526</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176526"/>
		<updated>2023-05-11T17:26:42Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Auto-tabbing between text input fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace the ID question at the end of the function call.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the last answer option&lt;br /&gt;
			var ansCount = $( &#039;div#question&#039; + qID + &#039; select option&#039; ).length - 1;&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer option at the end of the list&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; )&lt;br /&gt;
				.appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the qID (replace the qID eg. partRandDD(244)) &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
		//If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
     });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&#039;&#039;Tested with: 3.08 - 3.15&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 4.x==&lt;br /&gt;
&#039;&#039;Tested with: 4.5.1&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:qSort-4.x.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LimeSurvey Version 3.x==&lt;br /&gt;
Here is a custom question theme for LS 3.x - https://github.com/tpartner/LimeSurvey-Social-Value-Orientation&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176525</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176525"/>
		<updated>2023-05-11T17:17:51Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Expandable Array */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace the ID question at the end of the function call.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the last answer option&lt;br /&gt;
			var ansCount = $( &#039;div#question&#039; + qID + &#039; select option&#039; ).length - 1;&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer option at the end of the list&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; )&lt;br /&gt;
				.appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the qID (replace the qID eg. partRandDD(244)) &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
		//If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
     });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&#039;&#039;Tested with: 3.08 - 3.15&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 4.x==&lt;br /&gt;
&#039;&#039;Tested with: 4.5.1&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:qSort-4.x.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LimeSurvey Version 3.x==&lt;br /&gt;
Here is a custom question theme for LS 3.x - https://github.com/tpartner/LimeSurvey-Social-Value-Orientation&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176524</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=176524"/>
		<updated>2023-05-11T17:17:10Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Variable Length Array (Multi Flexible Text) question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace the ID question at the end of the function call.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the last answer option&lt;br /&gt;
			var ansCount = $( &#039;div#question&#039; + qID + &#039; select option&#039; ).length - 1;&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer option at the end of the list&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; )&lt;br /&gt;
				.appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the qID (replace the qID eg. partRandDD(244)) &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
		//If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. &lt;br /&gt;
		partRandDD(qID);&lt;br /&gt;
     });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&#039;&#039;Tested with: 3.08 - 3.15&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 4.x==&lt;br /&gt;
&#039;&#039;Tested with: 4.5.1&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:qSort-4.x.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LimeSurvey Version 3.x==&lt;br /&gt;
Here is a custom question theme for LS 3.x - https://github.com/tpartner/LimeSurvey-Social-Value-Orientation&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Participant_settings&amp;diff=160543</id>
		<title>Participant settings</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Participant_settings&amp;diff=160543"/>
		<updated>2021-02-18T12:09:42Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction= &amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:2--&amp;gt;&lt;br /&gt;
You can edit from this panel different survey participants table settings. For example, you can choose to anonymize all the responses you get from a survey or allow public survey registration. It represents together with the [[Survey participants]] panel a powerful feature of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:3--&amp;gt;&lt;br /&gt;
To access it, check the screenshot below:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Survey menu - participant tokens.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Participant settings panel= &amp;lt;!--T:5--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
The following options are available:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:7--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Participants tokens panel.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set token length to== &amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
Usually, the default value of 15 (max. supported value: 35) digits does not need to be changed. However, if you wish to change this setting, please enter a number (X) which is greater than 5. If the number entered is smaller than 5, it will be converted to the default value of 15. &#039;&#039;&#039;When generating tokens, all tokens will use a length of X digits.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Anonymized responses== &amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
This option allows you to determine whether responses to your survey are matched up with information from your survey participants table, or kept &amp;quot;anonymous&amp;quot;. The default is &amp;quot;No&amp;quot;. If you choose &amp;quot;Yes&amp;quot;, then your survey is set to anonymize responses - &#039;&#039;&#039;there will be no way to connect answers and participants&#039;&#039;&#039;. Even the admin will not be able to link response data and participant data. However, you will always be able to specifically view each response entered by your participants in the survey. Thus individual and anonymous analyses can still be done. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:10--&amp;gt;&lt;br /&gt;
{{Alert|title=Attention|text=If this feature is activated, the response submission date and the token completed date are always set to 1980-01-01 00:00, no matter of other settings. Invalidating the submission date ensures no match with webserver logs where the token key might show up when a survey is started. Invalidating the token completed date guarantees that you can&#039;t align the order of submitted responses to the order of the token date/time.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Enable token-based response persistence== &amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
If your survey uses tokens and your responses are not anonymized, you may want to enable this feature. If you turn this on, your participants will be able to leave the survey and resume later at any time &#039;&#039;&#039;without&#039;&#039;&#039; using the &amp;quot;Resume later&amp;quot; function - for example, when they get distracted or their browser crashes. Upon clicking the invitation link again, they will find their survey answers still in place when they return to the survey and will even find themselves on the same page where they were before leaving.&lt;br /&gt;
&lt;br /&gt;
==Allow multiple responses or update responses with one token== &amp;lt;!--T:12--&amp;gt;&lt;br /&gt;
If this option is activated, participants will be able to return to their survey by clicking the invitation link, even if they have already submitted the survey. If the survey is anonymous or &amp;quot;Enable token-based response persistence&amp;quot; is set to &amp;quot;No&amp;quot;, this will add a new response. If the survey is not anonymous and token-based response persistence is enabled, the user will update the existing responses.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Allow public registration== &amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
If you use tokens to control access to your survey, the only people who can use the survey are those who have an entry and a unique token allocated in the survey participants table. If you would like to use tokens, but also allow public registration, set this to &amp;quot;Yes&amp;quot;. The &amp;quot;Yes&amp;quot; setting will allow a visitor to register his name and email address. The script will create a new entry in your survey participants table for this person, then send them an invitation email. The script will ensure that only one person per email address can complete your survey.&lt;br /&gt;
&lt;br /&gt;
==Use HTML format for token emails== &amp;lt;!--T:14--&amp;gt;&lt;br /&gt;
When enabled, all emails sent via the LimeSurvey email system management interface (invite, reminder, confirmation) will be formatted as HTML. You&#039;ll then be able to use rich formatting for these emails. The default value is &amp;quot;Yes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
As of version 4.x, when using HTML format a WYSIWYG editor will be available to edit email templates. &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;!--T:15--&amp;gt;&lt;br /&gt;
{{Box|This settings is used for [[Notifications_%26_data#Basic_and_detailed_admin_notifications_email|basic and detailed admin notifications email ]] too.}}&lt;br /&gt;
{{Alert|title=Attention|text=When you switch on or off this feature, you&#039;ll have to double check that your email templates are still displayed as you want.}}&lt;br /&gt;
&lt;br /&gt;
==Send confirmation emails== &amp;lt;!--T:16--&amp;gt;&lt;br /&gt;
If enabled, the participant will receive a confirmation email that the survey was submitted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=159280</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=159280"/>
		<updated>2020-12-04T18:21:25Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* LimeSurvey Version 3.x */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 3.08&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LimeSurvey Version 3.x==&lt;br /&gt;
Here is a custom question theme for LS 3.x - https://github.com/tpartner/LimeSurvey-Social-Value-Orientation&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=159279</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=159279"/>
		<updated>2020-12-04T18:20:49Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Pay Off Matrix Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 3.08&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LimeSurvey Version 3.x==&lt;br /&gt;
Here is a custom question theme - https://github.com/tpartner/LimeSurvey-Social-Value-Orientation&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=159278</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=159278"/>
		<updated>2020-12-04T14:02:33Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Implementation LS Version 3.x: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item:last-child&#039;, thisQuestion).addClass(&#039;exclusive-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// A function to un-check boxes&lt;br /&gt;
		function resetCheckbox(thisItem) {&lt;br /&gt;
			$(&#039;:hidden&#039;, thisItem).val(&#039;&#039;);&lt;br /&gt;
			$(&#039;:checkbox&#039;, thisItem).prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;:checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				var thisItem = $(this).closest(&#039;.answer-item&#039;);				&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				var items = $(&#039;td.answer-item.exclusive-item&#039;, thisRow);&lt;br /&gt;
				if($(thisItem).hasClass(&#039;exclusive-item&#039;)) {&lt;br /&gt;
					items = $(&#039;td.answer-item:not(.exclusive-item)&#039;, thisRow);&lt;br /&gt;
				}&lt;br /&gt;
				$.each(items, function(i, el) {&lt;br /&gt;
					resetCheckbox(el);&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 3.08&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=149249</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=149249"/>
		<updated>2020-04-29T19:33:08Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Version 3.x */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 4.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 3.08&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=149248</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=149248"/>
		<updated>2020-04-29T19:32:28Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Card Sorting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
Here is a custom question theme for card Sorting in version 4.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-4.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 3.08&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=149247</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=149247"/>
		<updated>2020-04-29T19:30:27Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Version 3.x */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. - https://github.com/tpartner/LimeSurvey-Card-Sorting-3.x&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 3.08&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=149246</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=149246"/>
		<updated>2020-04-29T19:27:35Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Implicit Association Test (IAT) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  ExpressionScript (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, ExpressionScript (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[ExpressionScript#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ExpressionScript will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents ExpressionScript from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[ExpressionScript|ExpressionScript]].  See this [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[ExpressionScript|ExpressionScript]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[ExpressionScript|ExpressionScript]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[ExpressionScript|ExpressionScript]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[ExpressionScript how-tos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in ExpressionScript equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
Here is a custom question theme for an Implicit Association Test (IAT) in version 3.x - https://github.com/tpartner/LimeSurvey-Implicit-Association-Test&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create subquestions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 3.08&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire ExpressionScript&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Data_policy_settings&amp;diff=131800</id>
		<title>Data policy settings</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Data_policy_settings&amp;diff=131800"/>
		<updated>2018-11-29T12:37:46Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt; &amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction= &amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:2--&amp;gt;&lt;br /&gt;
The following panel allows you to add your own survey policy text, which, if enabled, must be accepted by your respondents in order to continue filling in the survey.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:3--&amp;gt;&lt;br /&gt;
The &#039;&#039;Data policy setting&#039;&#039; is located under the &#039;&#039;&#039;Settings&#039;&#039;&#039; tab, as it can be observed in the next screenshot:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Data policy settings location.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Data policy settings= &amp;lt;!--T:5--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
The following options can be edited from the &#039;&#039;Data policy settings&#039;&#039; panel:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:7--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Data policy settings panel.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Show survey policy text with mandatory checkbox:&#039;&#039;&#039; If enabled, a policy notice (e.g., regarding the protection of personal data) will be displayed on the welcome page to the survey respondents. The following options are available:&lt;br /&gt;
**&#039;&#039;Don&#039;t show&#039;&#039; : If chosen, no policy notice will be displayed to your survey respondents.&lt;br /&gt;
**&#039;&#039;Show as text&#039;&#039; : If enabled, the whole data security/policy text will be displayed after the welcome message. The checkbox will be displayed at the bottom of the text.&lt;br /&gt;
**&#039;&#039;Collapsible text&#039;&#039; : If enabled, only the checkbox text will be displayed. To access the full policy/data security text, the survey respondents will have to click on the &#039;&#039;&#039;Show policy&#039;&#039;&#039; button located under the checkbox text.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Survey data policy checkbox label:&#039;&#039;&#039; Fill in the following box to add the text you wish to be displayed next to the checkbox that needs to be ticked by your respondents to continue filling in your survey. If empty, the default text is: &amp;quot;To continue please first accept our survey data policy&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:10--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Survey data policy message:&#039;&#039;&#039; Fill in the textbox to add all the information related to your survey data policy (e.g., where the data is stored, for how long, and so on).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Survey data policy error message:&#039;&#039;&#039; In the case in which a respondent forgets to tick the survey data policy checkbox, the message from this textbox will be displayed on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:12--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] If you want to specify a link to the survey data policy, set &amp;quot;&#039;&#039;Show survey policy text with mandatory checkbox&#039;&#039;&amp;quot; to &amp;quot;&#039;&#039;Collapsible text&#039;&#039;&amp;quot; and use the placeholders {STARTPOLICYLINK} and {ENDPOLICYLINK} in the &amp;quot;&#039;&#039;Survey data policy checkbox label&#039;&#039;&amp;quot; field to define the link that opens the policy popup. If there is no placeholder given, there will be an appendix.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=129083</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=129083"/>
		<updated>2018-10-29T08:08:42Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Display secondary options in a &amp;quot;Multiple options&amp;quot; question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.5==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 3.x==&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create subquestions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 3.08&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=129082</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=129082"/>
		<updated>2018-10-29T08:06:07Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Display secondary options in a &amp;quot;Multiple options&amp;quot; question */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
Plugin [https://extensions.sondages.pro/questions-updating-and-managing/addscripttoquestion-easily-add-javascript/ addScriptToQuestion] allow to use a simple textarea for easily adding javascript. &lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have subquestions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with subquestion relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical subquestions and subquestion codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06, 2.5 and 3.x, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.06)&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary subquestions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 3.x)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of custom.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;li.question-item&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input:checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input:checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.on(&#039;change&#039;, function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false).trigger(&#039;change&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary subquestion and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, subquestion 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one subquestion at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the subquestion with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The subquestion code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all subquestions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a subquestion has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with subquestions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with subquestions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with subquestions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create subquestions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
= Q Sorting=&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 3.08&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround is heavily based on the Card Sorting above. It uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them with the additional twist to limit the cards per bucket. A multiple-short-text question is used with subquestions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; and their limits are pre-defined in a list in the &amp;quot;Display&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:QSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with subquestions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your subquestions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the subquestion order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last subquestions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=129079</id>
		<title>Workarounds: Question design, layout and templating</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=129079"/>
		<updated>2018-10-27T08:04:21Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Sliders With Control Buttons */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This section more or less deals with styling your survey, adjusting the layout and setting up special question types. You can find &#039;&#039;&#039;similar information&#039;&#039;&#039; at these pages:&lt;br /&gt;
* [[The template editor]]&lt;br /&gt;
* [[Workarounds: Manipulating a survey at runtime using Javascript]]&lt;br /&gt;
* [[Workarounds: Survey behaviour]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves. &amp;lt;span style=&#039;color:#EE0000&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Get rid of the question mark (help.gif)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.80+ (6536)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get rid of the question mark symbol that LimeSurvey displays at the end of a question, you can either upload an empty help.gif into the template folder (as discussed in the forum) or you can use the Template editor: Open the &#039;&#039;template.css&#039;&#039; of your template and search for &#039;&#039;div.questionhelp img&#039;&#039;, then add a &#039;&#039;visibility:hidden;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It will look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
div.questionhelp img  {&lt;br /&gt;
  margin:5px;&lt;br /&gt;
  visibility:hidden;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also &#039;&#039;&#039;replace the image&#039;&#039;&#039; by following [[The template editor#Replacing the help icon|these instructions]].&lt;br /&gt;
&lt;br /&gt;
=Require users to check a box agreeing to privacy statement before registering for a survey=&lt;br /&gt;
&lt;br /&gt;
If you need to have users positively acknowledge a privacy statement before submitting a registration form, the following will help you do this.&lt;br /&gt;
&lt;br /&gt;
It involves a minor modification to common.php in versions up to 1.85. Later versions may not require this.&lt;br /&gt;
&lt;br /&gt;
Edit common.php and look for the line (at approximately line 3014)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$registerform .= &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;input class=&#039;submit&#039; type=&#039;submit&#039; value=&#039;&amp;quot;.$clang-&amp;gt;gT(&amp;quot;Continue&amp;quot;).&amp;quot;&#039; /&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and change it to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$registerform .= &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;input id=&#039;registercontinue&#039; class=&#039;submit&#039; type=&#039;submit&#039; value=&#039;&amp;quot;.$clang-&amp;gt;gT(&amp;quot;Continue&amp;quot;).&amp;quot;&#039; /&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then save common.php. This gives you DOM access to the &amp;quot;continue&amp;quot; button on the register form, but will have no other practical effect or change to LimeSurvey&#039;s operations.&lt;br /&gt;
&lt;br /&gt;
Next, you need to edit the template you are using (see the documentation on the Template editor if you don&#039;t know how to do this).&lt;br /&gt;
&lt;br /&gt;
In the template editor, open the screen &amp;quot;Register page&amp;quot; and select the file &amp;quot;register.pstpl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
There are two modifications you need to make to this file. The first is to add the following code after the line that says &#039;&#039;{REGISTERFORM}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code disables the &amp;quot;Continue&amp;quot; button so that nobody can process the registration form until they&#039;ve clicked the checkbox.&lt;br /&gt;
&lt;br /&gt;
The second modification to make is to be done between the lines {REGISTERMESSAGE2} and {REGISTERFORM}. Add:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&lt;br /&gt;
 &amp;lt;label&amp;gt; Accept&lt;br /&gt;
   &amp;lt;input type=&#039;radio&#039;&lt;br /&gt;
          name=&amp;quot;privacy&amp;quot;&lt;br /&gt;
          value=&amp;quot;YES&amp;quot;&lt;br /&gt;
          onChange=&amp;quot;if(this.checked) {&lt;br /&gt;
                      document.getElementById(&#039;registercontinue&#039;).disabled=false;&lt;br /&gt;
                    }&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/label&amp;gt;&lt;br /&gt;
 &amp;lt;label&amp;gt;I don&#039;t accept&lt;br /&gt;
   &amp;lt;input type=&#039;radio&#039;&lt;br /&gt;
          name=&amp;quot;privacy&amp;quot;&lt;br /&gt;
          value=&amp;quot;NO&amp;quot;&lt;br /&gt;
          CHECKED&lt;br /&gt;
          onChange=&amp;quot;if(this.checked) {&lt;br /&gt;
                      document.getElementById(&#039;registercontinue&#039;).disabled=true;&lt;br /&gt;
                    }&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/label&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the users will have to agree to whatever text you replace &amp;quot;Do you agree to privacy stuff?&amp;quot; before they continue on and register.&lt;br /&gt;
&lt;br /&gt;
(Thanks to &#039;&#039;Pippo_Jedi&#039;&#039; for helping work this out)&lt;br /&gt;
&lt;br /&gt;
=Different progress indicator=&lt;br /&gt;
&lt;br /&gt;
==Version 1.87 and later:==&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will find the progress value and insert it into the element following the progress bar.&lt;br /&gt;
&lt;br /&gt;
It should be pointed out that I had to introduce a delay in firing the function because the progress value is not calculated until after template.js is called. The delay is set at 1/10 of a second but you may be able to reduce that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // Display progress value&lt;br /&gt;
&lt;br /&gt;
   function setProgValue() {&lt;br /&gt;
&lt;br /&gt;
       var progress = $(&#039;#progressbar&#039;).attr(&#039;aria-valuenow&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).text(progress+&#039;%&#039;).show();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
       setTimeout(&#039;setProgValue()&#039;,100);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to hide the &amp;quot;0%&amp;quot; before the progress bar, add the following to the end of template.css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#progress-pre {&lt;br /&gt;
&lt;br /&gt;
   display: none;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Delete unwanted gaps in question title=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When copying data (questions, answers, ...) from MS Word or other applications into the editor there might occur some gaps in the question title.&lt;br /&gt;
&lt;br /&gt;
There are two solutions to this:&lt;br /&gt;
# Use popup mode and manually delete unwanting extra html tags (requires html knowledge).&lt;br /&gt;
# Disable paste word feature: Tweak your limesurvey-config.js file in limesurvey/admin/scripts/fckeditor.26 and set the following option to true:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;FCKConfig.ForcePasteAsPlainText = true ;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that clear you browser cache and try again.&lt;br /&gt;
&lt;br /&gt;
=How to change the &amp;lt;font-size&amp;gt; tags using CSS=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This workaround was deleted because it is outdated. Such changes can be done by [[The template editor#Styling questions with CSS|adjusting template.css]] of your template.&lt;br /&gt;
&lt;br /&gt;
=Question type variation: Scale with bars (one and two sided)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some methodogical issues to think about: Very often a common scale as 1 to 5 or -2 to +2 fits all needs, as the shown subject is clearly defined as positive or negative. As soon as you would reduce the influence from the question and scale on the respondent, you will need something neutral to determine tendences, emphases and so on.&lt;br /&gt;
&lt;br /&gt;
So I put up a new variation of the one and two sided array question:&lt;br /&gt;
&lt;br /&gt;
ttp://www.limesurvey.org/images/fbfiles/images/example_bar_scale.jpg&lt;br /&gt;
&lt;br /&gt;
In my example the left side reads &amp;quot;strategical planning&amp;quot; and the right side &amp;quot;operative business&amp;quot;. None of these are purely negative or positive, so the bars only show in which direction the balancing point moves.&lt;br /&gt;
&lt;br /&gt;
To realize a question as shown above just do as follows:&lt;br /&gt;
&lt;br /&gt;
Set up as many bars as you will need (in my example there are four different bars in total) with a graphic program like PAINT .NET, GIMP or similar ones (yes, you may also use commercial software like Photoshop). To prevent the bars from looking twitchy, designate the size in advance. I did one bar 60x15 px, one 45x15px, one 30x15px and at last 15x15px. Save them as PNG, JPG or GIF.&lt;br /&gt;
# Create a new label set within Lime. Call it whatever you like.&lt;br /&gt;
# Enter a code number at first, then press the pencil symbol to enter the editor.&lt;br /&gt;
#Press the &amp;quot;Insert / edit image&amp;quot; button and upload the bar you want to insert with the FCK upload tool. Then choose the uploaded picture, save and leave the FCK editor.&lt;br /&gt;
#The row in the lable editor now shows an &amp;lt;img&amp;gt;-tag which refers to your bar picture.&lt;br /&gt;
#Repeat the above described steps as often as needed to build up your bar scale.&lt;br /&gt;
&lt;br /&gt;
=Doing a Likert Scale=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A Likert Scale is a special type of the Semantic Differential question where several item shall be rated on different scales, each marked at the beginning and at the end with opposite statements. &lt;br /&gt;
&lt;br /&gt;
To do this in LimeSurvey just follow these steps:&lt;br /&gt;
#Create a label set with values from 0 to 7 (for the classic Likert Scale - feel free to choose other ranges).&lt;br /&gt;
#Create a new question and choose Array (Flexible Labels) as question type.&lt;br /&gt;
#Assign the Likert Scale label set to this question.&lt;br /&gt;
#Enter your answers as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;DIV style=&amp;quot;white-space: nowrap;&amp;quot;&amp;gt;ITEM statement1|statement2&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The white-space style is to avoid line breaks which would ruin the whole scale. feel free to insert non-breakable spaces between the ITEM and statement1 to define the margin between these to strings.&lt;br /&gt;
&lt;br /&gt;
=Alternate background colour of questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To alternate the background colour of questions, open the &#039;&#039;template.css&#039;&#039; of your template with the Template Editor or a text editor and modify the &#039;&#039;Question styles&#039;&#039; section to include the following style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
div#question2 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question4 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question6 td.questiontext {&lt;br /&gt;
&lt;br /&gt;
   background-color: #E0EBF8;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to apply the style to all of the questions you would like modified using their question IDs (&#039;&#039;question2, question4, question6&#039;&#039; in this case). Question IDs are displayed when creating or editing questions - see below:&lt;br /&gt;
&lt;br /&gt;
[[File:qid_1_493x173.gif]]&lt;br /&gt;
&lt;br /&gt;
Here the question ID is #question80 .&lt;br /&gt;
&lt;br /&gt;
=Embedding audio in questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191), IE 7, FireFox 3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Audio clips can be embedded in most question text or answer text. In this example, using the default template, I&#039;ve embedded clips into the answers of an &#039;&#039;&#039;&#039;&#039;Array (Yes/No/Uncertain)&#039;&#039;&#039;&#039;&#039; question to ask respondents how they feel about some sounds. The resulting question will look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x202.gif]]&lt;br /&gt;
&lt;br /&gt;
It&#039;s accomplished by placing the following code in each of the answers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;embed height=&amp;quot;20&amp;quot; width=&amp;quot;128&amp;quot; autostart=&amp;quot;false&amp;quot; controls=&amp;quot;console&amp;quot;&lt;br /&gt;
&lt;br /&gt;
loop=&amp;quot;true&amp;quot; volume=&amp;quot;50&amp;quot; src=&amp;quot;{TEMPLATEURL}audio_1.mp3&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some notes about the code:&lt;br /&gt;
*The &#039;&#039;audio_1.mp3&#039;&#039; part will be different for each answer (it&#039;s the audio file name).&lt;br /&gt;
*In this case the audio files are residing in the template folder being used for this survey (that&#039;s where &#039;&#039;{TEMPLATEURL}&#039;&#039; points to) but they can be placed anywhere if you use an absolute URL in the &#039;&#039;src&#039;&#039; parameter - something like &#039;&#039;src=&amp;quot;http://mysite.com/audio/audio_1.mp3&amp;quot;&#039;&#039;&lt;br /&gt;
*If the audio file doesn&#039;t exist where the &#039;&#039;src&#039;&#039; parameter indicates, the player will not appear.&lt;br /&gt;
*You&#039;ll need to insert the code into the answers using the source screen - click on &amp;quot;Edit answers&amp;quot;, click the pencil beside the text box, click &amp;quot;Source&amp;quot; in the pop-up, enter the code and save it with the little diskette icon.&lt;br /&gt;
*You may need to turn off the XSS filter - see the documentation for [http://docs.limesurvey.org/tiki-index.php?page=Global+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Security Global settings].&lt;br /&gt;
&lt;br /&gt;
Although the above example places the audio in the answer text of the question, the same principles can be used to place it in the question text itself. Something like this perhaps.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x154.gif]]&lt;br /&gt;
&lt;br /&gt;
=Hiding inputs of a &amp;quot;Multiple options with comments&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&lt;br /&gt;
&lt;br /&gt;
There may be times when you want to hide some of the input boxes of a &#039;&#039;&#039;&#039;&#039;Multiple options with comments&#039;&#039;&#039;&#039;&#039; question as in the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:hidden_inputs_541x168.gif]]&lt;br /&gt;
&lt;br /&gt;
This can be accomplished with CSS (see [[The template editor#Styling questions with CSS|Styling questions in LimeSurvey 1.8]]). For each input that you want to hide, add the following style to your template.css file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#answer11111X22X33Acomment {&lt;br /&gt;
   display: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Where 11111 is your survey ID, 22 is your group ID, 33 is your question ID and A is the answer code.&lt;br /&gt;
&lt;br /&gt;
Note that you will still see columns for the hidden inputs in your data but they will be empty.&lt;br /&gt;
&lt;br /&gt;
=Multiple question types in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90 - 1.92+, IE 7/8/9, Firefox 13, Safari 5, Chrome 10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Media:limesurvey_survey_62584.lss|Download the sample survey]]&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present multiple question types in what appears to be an array - as depicted in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=62584&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here] (download the sample survey - [[Media:limesurvey_survey_62584.lss|limesurvey_survey_62584.lss]]). This example uses the default template but should be adaptable to any template using divisions for question containers.&lt;br /&gt;
&lt;br /&gt;
[[File:inline_questions_700x228.png]]&lt;br /&gt;
&lt;br /&gt;
Basically what we do is take groups of questions (5 in this case), wrap them in a division and make them line up nicely horizontally and vertically. The width of the survey is also fixed to prevent wrapping issues. We do this with a JavaScript/jQuery function that inserts the necessary wrappers and then modifies styles so everything behaves properly. The top row is 5 boilerplate questions with the &amp;quot;column headers&amp;quot; as question text (the first just has a blank space). The following rows are a boilerplate with the &amp;quot;row headers&amp;quot; followed by 4 assorted questions.&lt;br /&gt;
&lt;br /&gt;
It should be noted that using conditions on these questions may result in unexpected behavior. If a question is hidden by conditions, the question(s) to the right of it will move over to take its place.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Create your questions keeping in mind how they will lay out when grouped into rows (in this example - boilerplate, yes/no, short text, numeric, dropdown, and repeat).&lt;br /&gt;
#In the source of the first boilerplate question add the function below (see [http://manual.limesurvey.org/wiki/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F How to use script]).&lt;br /&gt;
#Modify the number of rows, number of columns and the start placement in the function call (line 6) as required (the example uses 4 rows and 5 columns and the &amp;quot;array&amp;quot; starts with the third question on the page).&lt;br /&gt;
&lt;br /&gt;
The code may look intimidating at first but it&#039;s actually fairly simple. I&#039;ve laid it out as sequentially as possible and purposely used few shortcuts and many comments to make it easier to follow.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
*If you use question types other than boilerplate, short text, list dropdown, numeric or yes-no, you&#039;ll need to add to the last section of code, where it hides the question text and formats the inputs for display this way.&lt;br /&gt;
*Any extra questions on the page should follow this grid of questions, not precede them.&lt;br /&gt;
* If you use boilerplate as question type you should add after:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
the following 2 lines&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
//repair boilerplate questioncells&lt;br /&gt;
$(&#039;div.boilerplate td.questiontext&#039;).parent().show();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Javascript code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the &amp;quot;sideBySide&amp;quot; function with number of rows, columns and start position&lt;br /&gt;
		sideBySide(4, 5, 3);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function sideBySide(rows, columns, startQuestion) {&lt;br /&gt;
&lt;br /&gt;
		/*********** Display multiple questions side by side ***********/&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;div.qRow1&#039;).length == 0) {&lt;br /&gt;
&lt;br /&gt;
			var rowNum = 0;&lt;br /&gt;
			var colNum = 1;&lt;br /&gt;
			var rowList = new Array();&lt;br /&gt;
&lt;br /&gt;
			//////// Add question classes for later use ////////&lt;br /&gt;
&lt;br /&gt;
			// Loop through all questions and add row and column specific classes&lt;br /&gt;
			$(&#039;div[id^=&amp;quot;question&amp;quot;]&#039;).each(function(i) {&lt;br /&gt;
				if(i &amp;gt;= (startQuestion-1) &amp;amp;&amp;amp; rowNum &amp;lt; rows) { // This IF condition only needed if there are questions before or following the &amp;quot;inline&amp;quot; questions&lt;br /&gt;
					$(this).addClass(&#039;qRow&#039;+rowNum+&#039;&#039;).addClass(&#039;qCol&#039;+colNum+&#039;&#039;).addClass(&#039;inlineQuestion&#039;);&lt;br /&gt;
					if(rowNum == 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;columnLabel&#039;);&lt;br /&gt;
					}  &lt;br /&gt;
					if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum == 1) {&lt;br /&gt;
						$(this).addClass(&#039;rowLabel&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;questionCell&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					if(colNum == columns) {&lt;br /&gt;
						rowList.push(&#039;qRow&#039;+rowNum+&#039;&#039;);&lt;br /&gt;
						rowNum++;&lt;br /&gt;
						colNum = 1;&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						colNum++;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).addClass(&#039;normalQuestion&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Survey layout manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Fix the width of the survey&lt;br /&gt;
			$(&#039;table.outerframe&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;900px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Wrap each &amp;quot;row&amp;quot; in a wrapper div&lt;br /&gt;
			$(rowList).each(function(i) {&lt;br /&gt;
				$(&#039;.&#039;+this+&#039;&#039;).wrapAll(&#039;&amp;lt;div id=&amp;quot;inlineWrapper&#039;+i+&#039;&amp;quot; class=&amp;quot;inlineRow&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Style the wrapper divs&lt;br /&gt;
			$(&#039;.inlineRow&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;850px&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0 auto 0 auto&#039;,&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.inlineRow:first&#039; ).css({&lt;br /&gt;
				&#039;margin-top&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get all the questions to sit politely side by side&lt;br /&gt;
			$( &#039;.inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;float&#039;: &#039;left&#039;,&lt;br /&gt;
				&#039;height&#039;:&#039;41px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;-8px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;.inlineQuestion .questionhelp&#039; ).hide();&lt;br /&gt;
			$( &#039;.inlineQuestion .survey-question-help&#039; ).parent().hide();&lt;br /&gt;
		   &lt;br /&gt;
			// A little space under the last row&lt;br /&gt;
			$( &#039;.inlineRow:last .inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Any questions not displayed inline (this is only needed if there are questions following the &amp;quot;inline&amp;quot; questions)&lt;br /&gt;
			$( &#039;.normalQuestion&#039; ).css({&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Column manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Set the column widths - can be set individually if necessary&lt;br /&gt;
			// Must add up to less than 100%&lt;br /&gt;
			$( &#039;.qCol1&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;12%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.qCol2, .qCol3, .qCol4, .qCol5&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;22%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Question manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Hide the answer element in boilerplate questions&lt;br /&gt;
			$( &#039;div.boilerplate td.answer&#039; ).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
			$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Push the question tables to 100%&lt;br /&gt;
			$( &#039;div.inlineRow table&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;100%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get everything to line up nicely vertically&lt;br /&gt;
			$( &#039;.inlineQuestion td.questiontext, .inlineQuestion td.answer p&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Adjust cell heights so everything lines up nicely horizontally&lt;br /&gt;
			$( &#039;.inlineQuestion td.answer, .inlineQuestion td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;35px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;0.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;#inlineWrapper0 .inlineQuestion&#039; ).css({ &#039;height&#039;:&#039;50px&#039; });&lt;br /&gt;
			$( &#039;#inlineWrapper0 td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;50px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Yes-no question styles&lt;br /&gt;
			$( &#039;div.yes-no ul&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;,&lt;br /&gt;
				&#039;font-size&#039;: &#039;90%&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0&#039;,&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;5px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no li&#039; ).css({&lt;br /&gt;
				&#039;padding-right&#039;: &#039;1.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no td.answer&#039; ).css({&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Short-text question styles&lt;br /&gt;
			$( &#039;div.text-short input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Numeric question styles&lt;br /&gt;
			$( &#039;div.numeric input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.numeric p.tip&#039; ).css({&lt;br /&gt;
				&#039;display&#039;: &#039;none&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get rid of the margins around select boxes&lt;br /&gt;
			$( &#039;p.question&#039; ).css({ &#039;margin&#039;:&#039;0&#039; });&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Star Rating System=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://www.fyneworks.com/jquery/star-rating/ jQuery Star Rating Plugin] to display a series of stars that are used to generate a rating value. This value is then passed to either a hidden numeric input question or a hidden list radio question. Both methods are outlined below - use one or both depending on whether you want to use [Assessments|assessments].&lt;br /&gt;
&lt;br /&gt;
The plugin uses a series of radio inputs to generate the stars (more about these below). It allows the use of whole or partial stars as shown in [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en this demo] and the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x324.png]]&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using Numeric Input Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like your rating data to be collected as a numeric value and don&#039;t want to use [[Assessments|LimeSurvey assessments]] - it&#039;s a little easier to implement. There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en here] (first question).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#[http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
##jquery.MetaData.js&lt;br /&gt;
##jquery.rating.css&lt;br /&gt;
##jquery.rating.js&lt;br /&gt;
##delete.gif&lt;br /&gt;
##star.gif&lt;br /&gt;
#In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a numeric input question and then in the source of the question add as many radio inputs as star segments. For example, if you would like 5 stars, each with half-segments (as in the demo Q1), you would need 10 radio inputs and that would give rating values from 1-10.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q1 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;6&amp;quot; value=&amp;quot;6&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;7&amp;quot; value=&amp;quot;7&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;8&amp;quot; value=&amp;quot;8&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;9&amp;quot; value=&amp;quot;9&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;10&amp;quot; value=&amp;quot;10&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. A note on split stars. The stars in the above example are split in half by the &#039;&#039;{ split:2 }&#039;&#039; metadata. So if you don&#039;t want split stars, your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
7. Finally, in the source of the question add the following function after your inputs. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the numeric input and pass the rating values into it as they are changed. If the rating is canceled the numeric input is nullified. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingNumeric(11111, 22, 1); handleRatingNumeric(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingNumeric (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the numeric input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val();&lt;br /&gt;
&lt;br /&gt;
   if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the numeric question&lt;br /&gt;
&lt;br /&gt;
handleRatingNumeric (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using List (Radio) Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like to use [[Assessments|assessments]]. There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en here] (second question).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
&lt;br /&gt;
2. Set up the template to use custom onload functions. (See the [[Workarounds: Manipulating a survey at runtime using Javascript#Custom onload function|workaround here]])&lt;br /&gt;
&lt;br /&gt;
3. [http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
*jquery.MetaData.js&lt;br /&gt;
*jquery.rating.css&lt;br /&gt;
*jquery.rating.js&lt;br /&gt;
*delete.gif&lt;br /&gt;
*star.gif&lt;br /&gt;
&lt;br /&gt;
4. In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a list (radio) question with the same amount of sequentially numbered answers as star ratings. For example, if you want 5 whole-stars, you would create 5 answers, as in the image below, and this would give you ratings from 1-5. Note that the &amp;quot;Codes&amp;quot; and &amp;quot;Answers&amp;quot; must be sequential numbers.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x156_v2.png]]&lt;br /&gt;
&lt;br /&gt;
6. In the list (radio) question, set the [[Advanced question settings|hide_tip]] question attribute to 1&lt;br /&gt;
&lt;br /&gt;
7. In the source of the question add as many radio inputs as star segments. So 5 whole-stars (as in the demo Q2), would need 5 radio inputs.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q2 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. A note on split stars. The stars in the above example are whole-stars. If you want them split you need to add metadata to the class - something like &#039;&#039;{ split:2 }&#039;&#039;. So if you want half-stars your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
9. Finally, in the source of the question add the following function after your inputs. (See [http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure;=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ How to use script here])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the question radio buttons and toggle them as the rating values are changed. If the rating is canceled all question inputs are unchecked. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingRadio(11111, 22, 1); handleRatingRadio(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Onload code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingRadio (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the radio input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#question&#039; + qID + &#039; input.radio[checked=true]&#039;).attr(&#039;value&#039;);&lt;br /&gt;
&lt;br /&gt;
   //if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
   if ( rating ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio[value=&#039; + rating + &#039;]&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the radio question&lt;br /&gt;
&lt;br /&gt;
handleRatingRadio (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable column widths in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define all column widths of an array question - as shown in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here]. This example uses the default template shipped with 7557 but should be adaptable to any template.&lt;br /&gt;
&lt;br /&gt;
[[File:array_widths_701x226.gif]]&lt;br /&gt;
&lt;br /&gt;
We use a function to remove all of the widths imposed by the core code and then insert our own.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects documentation here]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Replace all instances of QQ with the question ID.&lt;br /&gt;
#In the third section of code, adjust the widths and add/remove columns as necessary. This example is for an array with a question text column followed by 3 answer columns as shown above.&lt;br /&gt;
#In the final section adjust the question text alignment to your liking&lt;br /&gt;
&lt;br /&gt;
Onload code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // Get rid of all the widths that the API imposes&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question col&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question thead td&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define a width for the question table so we can do so for its children&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Keep this to 95% or less so IE will behave&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question&#039; ).attr(&#039;width&#039;, &#039;95%&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define the column widths&lt;br /&gt;
&lt;br /&gt;
   // Add or remove columns and adjust widths as necessary but widths should add up to 100%&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Columns must be sequentially numbered starting at 0 - eg, td:eq(0), td:eq(1), td:eq(2).....&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th:eq(0)&#039; ).css({ &#039;width&#039;:&#039;10%&#039; }); // Answer text column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(0)&#039; ).css({ &#039;width&#039;:&#039;50%&#039; }); // First answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(1)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Second answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(2)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Third answer column&lt;br /&gt;
&lt;br /&gt;
   // Push the text input widths to 95% of their parent containers&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question input[type=&amp;quot;text&amp;quot;]&#039; ).css({ &#039;width&#039;:&#039;95%&#039; });&lt;br /&gt;
&lt;br /&gt;
   // Align the answer text - feel free to experiment&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th&#039; ).css({&#039;text-align&#039;:&#039;center&#039;});&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use images for radio buttons and checkboxes=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.92/2.0, using IE 9, FireFox 13, Chrome 16, Safari 5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses an adaptation of the jQuery imagetick.js plugin to replace the default radio buttons and checkboxes with images as pictured below:&lt;br /&gt;
&lt;br /&gt;
[[File:images.png]] &lt;br /&gt;
&lt;br /&gt;
This adaptation will work in the following question types:&lt;br /&gt;
*Array&lt;br /&gt;
*Array by column&lt;br /&gt;
*Array dual scale&lt;br /&gt;
*Array (5 point choice)&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
*Array (Increase-Same-Decrease)&lt;br /&gt;
*Array (Yes-No-Uncertain)&lt;br /&gt;
*Gender&lt;br /&gt;
*Yes-No&lt;br /&gt;
*Multiple choice&lt;br /&gt;
*Multiple choice with comments&lt;br /&gt;
*5 point choice&lt;br /&gt;
*List (Radio)&lt;br /&gt;
*List with comment&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey 1.92 and earlier implementation==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Download [[Media:imagetick_lime_v1.3.zip|this modified version of the plugin]].&lt;br /&gt;
#Extract all files and place them in your template directory.&lt;br /&gt;
#Add the following line to the &amp;lt;head&amp;gt; element in your startpage.pstpl &#039;&#039;&#039;BEFORE&#039;&#039;&#039; the call for template.js:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}imagetick_lime.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the source of a question or the group description&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		var templatePath = $(&#039;head link[href*=&amp;quot;template.css&amp;quot;]&#039;).attr(&#039;href&#039;).replace(/template.css/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Apply images to radios&lt;br /&gt;
		$(&#039;input[type=&amp;quot;radio&amp;quot;]&#039;).imageTick({&lt;br /&gt;
&lt;br /&gt;
			// Image to use as a selected state of the radio&lt;br /&gt;
			tick_image_path:  templatePath+&amp;quot;radio.gif&amp;quot;,&lt;br /&gt;
			// Image to use as a non-selected state&lt;br /&gt;
			no_tick_image_path:  templatePath+&amp;quot;no_radio.gif&amp;quot;,&lt;br /&gt;
			// Class to apply to all radio images that are dynamically created&lt;br /&gt;
			image_tick_class: &amp;quot;radios&amp;quot;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Apply images to checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;).imageTick({&lt;br /&gt;
&lt;br /&gt;
			// Image to use as a selected state of the checkbox&lt;br /&gt;
			tick_image_path: templatePath+&amp;quot;check.gif&amp;quot;,&lt;br /&gt;
			// Image to use as a non-selected state&lt;br /&gt;
			no_tick_image_path: templatePath+&amp;quot;no_check.gif&amp;quot;,&lt;br /&gt;
			// Class to apply to all checkbox images that are dynamically created&lt;br /&gt;
			image_tick_class: &amp;quot;checkboxes&amp;quot;&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#You can also call the imagetick function from template.js. Skip the last step above and add the following to the end of template.js. Replace &amp;quot;yourTemplateName&amp;quot; with your template directory name.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
	var templatePath = $(&#039;head link[href*=&amp;quot;template.css&amp;quot;]&#039;).attr(&#039;href&#039;).replace(/template.css/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
	// Apply images to radios&lt;br /&gt;
	$(&#039;input[type=&amp;quot;radio&amp;quot;]&#039;).imageTick({&lt;br /&gt;
&lt;br /&gt;
		// Image to use as a selected state of the radio&lt;br /&gt;
		tick_image_path: templatePath+&amp;quot;radio.gif&amp;quot;,&lt;br /&gt;
		// Image to use as a non-selected state&lt;br /&gt;
		no_tick_image_path: templatePath+&amp;quot;no_radio.gif&amp;quot;,&lt;br /&gt;
		// Class to apply to all radio images that are dynamically created&lt;br /&gt;
		image_tick_class: &amp;quot;radios&amp;quot;&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	// Apply images to checkboxes&lt;br /&gt;
	$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;).imageTick({&lt;br /&gt;
&lt;br /&gt;
		// Image to use as a selected state of the checkbox&lt;br /&gt;
		tick_image_path: templatePath+&amp;quot;check.gif&amp;quot;,&lt;br /&gt;
		// Image to use as a non-selected state&lt;br /&gt;
		no_tick_image_path: templatePath+&amp;quot;no_check.gif&amp;quot;,&lt;br /&gt;
		// Class to apply to all checkbox images that are dynamically created&lt;br /&gt;
		image_tick_class: &amp;quot;checkboxes&amp;quot;&lt;br /&gt;
	});&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
If you want to apply it to only one question on a page use selector (where QQ is the question ID)&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#questionQQ input[type=&amp;quot;radio&amp;quot;]&#039;)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
If you want to apply it to a single radio button in a question (to maybe have different images for each option) use selector (where SSSSS is the survey ID, GG is the group ID, QQ is the question ID, AA is the answer code)&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&amp;quot;input#answerSSSSSXGGXQQAA&amp;quot;)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey 2.0 and later implementation==&lt;br /&gt;
&lt;br /&gt;
Follow the instructions above with these changes:&lt;br /&gt;
#Download [[Media:Imagetick_lime_v2.1.zip|this modified version of the plugin for 2.0 and up]] instead of the one mentioned above and add all contained files to your template directory.&lt;br /&gt;
#Add these lines to the &amp;lt;head&amp;gt; element in your startpage.pstpl instead of the one above:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}imagetick_lime_2.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}imagetick_lime_2.css&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thanks to Jordan Boesch for the original plugin.&lt;br /&gt;
&lt;br /&gt;
=Changing the position and layout of an individual question using &amp;quot;question code&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (6536)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use this very flexible workaround you first have to apply a minor change to the question.pstpl of the used template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
needs to be changed to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this change won&#039;t change anything in the layout and can be left in the template even if you don&#039;t need this workaround. It&#039;s just a means to have a handle to actually change individual questions.&lt;br /&gt;
&lt;br /&gt;
You can then use a code such as the following in the question text to make question specific format changes. &amp;quot;SAMPLE&amp;quot; needs to be replaced with the concerning question code and javascript has to be allowed ([[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|older versions of limesurvey]], under global settings for newer versions).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.borderTop= &amp;quot;0px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginTop= &amp;quot;-62px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginLeft= &amp;quot;30px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sample code will hide the border at the top of the question, will move the whole question up by 62px and to the right by 30px. Using this workaround you can change a whole a lot of things concerning format and positions of a specific question without changing all the questions. A (German) list of all the allowed options can be found [http://de.selfhtml.org/javascript/objekte/style.htm#style_eigenschaften here].&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
==Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Assign a label set to the question - these will be the labels in the center column.&lt;br /&gt;
#Set the second parameter of the function call to true for randomized rows.&lt;br /&gt;
#Adjust the styles in lines 21-24 as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The script moves the question columns into the MaxDiff configuration and disables the opposing radio element when a selection is made.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
	&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, false);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function maxDiff(qID, randomize) {&lt;br /&gt;
		&lt;br /&gt;
		// Random number between 1 and 2&lt;br /&gt;
		// Math.floor(Math.random() * (max - min + 1)) + min;&lt;br /&gt;
		var randomNum = Math.floor(Math.random() * ((2-1)+1) + 1);&lt;br /&gt;
&lt;br /&gt;
		// Move the columns&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col:eq(1)&#039;).prependTo(&#039;colgroup.col-responses&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list thead tr:eq(0) th:eq(0)&#039;).prependTo(&#039;#question&#039;+qID+&#039; table.question thead tr:eq(0)&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Random rows&lt;br /&gt;
		if(randomize) {&lt;br /&gt;
			var rowsArr = [];&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
				$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
				rowsArr.push(i);&lt;br /&gt;
			});&lt;br /&gt;
			shuffleArray(rowsArr);&lt;br /&gt;
			$(rowsArr).each(function(i){&lt;br /&gt;
				$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody&#039;).append($(&#039;#question&#039;+qID+&#039; tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Style stuff&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col.odd&#039;).css({ &#039;background-color&#039;:&#039;transparent&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody th&#039;).css({ &#039;text-align&#039;:&#039;center&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:even td, #question&#039;+qID+&#039; table.question tbody tr:even th&#039;).css({ &#039;background-color&#039;:&#039;#F1F1F1&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:odd td, #question&#039;+qID+&#039; table.question tbody tr:odd th&#039;).css({ &#039;background-color&#039;:&#039;#FCFCFC&#039; });&lt;br /&gt;
&lt;br /&gt;
		// Prevent clicking twice in the same row&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input.radio&#039;).on(&#039;click&#039;, function () {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio&#039;).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio:checked&#039;).each(function(i) {&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				$(&#039;input.radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function shuffleArray(array) {&lt;br /&gt;
		for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
			var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
			var temp = array[i];&lt;br /&gt;
			array[i] = array[j];&lt;br /&gt;
			array[j] = temp;&lt;br /&gt;
		}&lt;br /&gt;
		return array;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Versions 2.5 and 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:MaxDiff_2.5.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Template.zip|Demo template]]&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Survey.zip|Demo survey]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Add 2 subquestions to the array - these will be the left and right columns.&lt;br /&gt;
#Add answers to the array - these will be the rows.&lt;br /&gt;
#Create a copy the default template.&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.js&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function maxDiff(qID, randomize) {&lt;br /&gt;
 &lt;br /&gt;
	// Identify some elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisTable = $(&#039;table.subquestion-list:eq(0)&#039;, thisQuestion);&lt;br /&gt;
 &lt;br /&gt;
	// Assign a new question class&lt;br /&gt;
	$(thisQuestion).addClass(&#039;max-diff-array&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Move the columns&lt;br /&gt;
	$(&#039;thead tr:eq(0)&#039;, thisTable).prepend($(&#039;thead tr:eq(0) th:eq(1)&#039;, thisTable));&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
		$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Random rows&lt;br /&gt;
	if(randomize) {&lt;br /&gt;
		var rowsArr = [];&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
			$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
			rowsArr.push(i);&lt;br /&gt;
		});&lt;br /&gt;
		shuffleArray(rowsArr);&lt;br /&gt;
		$(rowsArr).each(function(i){&lt;br /&gt;
			$(&#039;tbody&#039;, thisTable).append($(&#039;tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;, thisTable));&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	// Prevent clicking twice in the same row&lt;br /&gt;
	$(&#039;input:radio&#039;, thisQuestion).on(&#039;click&#039;, function () {&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;input:radio&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		$(&#039;input:radio:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr.answers-list&#039;);&lt;br /&gt;
			$(&#039;input:radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		});&lt;br /&gt;
	});	&lt;br /&gt;
 &lt;br /&gt;
	// Fix up the row classes&lt;br /&gt;
	var rowClass = 1;&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i) {&lt;br /&gt;
		$(this).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.css&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.max-diff-array th.answertext { &lt;br /&gt;
	text-align: center;&lt;br /&gt;
	border-right: 3px solid #FFFFFF;&lt;br /&gt;
	border-left: 3px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
/* Override the responsive &amp;quot;no-more-tables&amp;quot; stuff */&lt;br /&gt;
@media only screen and (max-width: 801px) {&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables table {&lt;br /&gt;
		display: table;&lt;br /&gt;
		border-collapse: inherit;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables thead, &lt;br /&gt;
	.max-diff-array .no-more-tables tbody {&lt;br /&gt;
		display: table-row-group;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables tr {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		position: relative;&lt;br /&gt;
		top: auto;&lt;br /&gt;
		display: table-row;&lt;br /&gt;
		border: 0 none;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables th, &lt;br /&gt;
	.max-diff-array .no-more-tables td {&lt;br /&gt;
		display: table-cell;&lt;br /&gt;
		text-align: center !important;&lt;br /&gt;
		color: #2c3e50;&lt;br /&gt;
		font-size: 15px;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array th.answertext { &lt;br /&gt;
		border-right: 3px solid #FFFFFF;&lt;br /&gt;
		border-left: 3px solid #FFFFFF;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .answer-item label span {&lt;br /&gt;
		display: none !important;&lt;br /&gt;
	}	&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add a script like this to the question source of the Array (flexible labels) question:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	   &lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, true);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Load SVG Code From Drawing Tool=&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to load a drawing tool and store the results in a huge-text question. The details are outlined in the [[Workarounds: Manipulating a survey at runtime using Javascript#Load SVG Code From Drawing Tool|JavaScript section of the workarounds]].&lt;br /&gt;
&lt;br /&gt;
=Minimum or Maximum Date in Datepicker=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note: From version 2.05 beta6, you MUST set the minimum and maximum date for the date picker directly in the advanced question attributes of the date/time question. This workaround will seize to work.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can set the minimum or maximum selectible date in a datepicker as follows&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]] and add the following to the source of the date question text or help. Replace &amp;quot;QQ&amp;quot; with the date question ID.&lt;br /&gt;
&lt;br /&gt;
For a minimum date of April 15, 2010:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date(2010, 4-1, 15) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a minimum date of the current date (today):&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date() );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a maximum date of May 10, 2015:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date(2015, 5-1, 10) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More details here - http://jqueryui.com/demos/datepicker/#option-minDate&lt;br /&gt;
&lt;br /&gt;
=Evaluative Space Grid (ESG)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 &amp;amp; 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The evaluative space grid (ESG) is a two-dimensional grid that provides a single-item measure of positivity and negativity (Larsen et al, 2009). See [http://leeds-faculty.colorado.edu/mcgrawp/pdf/larsen.norris.mcgraw.hawkley.cacioppo.2009.pdf page 4 of this PDF].&lt;br /&gt;
&lt;br /&gt;
This can be accomplished using a multiple-numeric question, some simple HTML and a little JavaScript.&lt;br /&gt;
&lt;br /&gt;
A table can be shown in the question. When a respondent clicks a grid cell in the table JavaScript loads the coordinates of the cell into the multiple-numeric question inputs.&lt;br /&gt;
&lt;br /&gt;
[[File:Space_grid_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create a Multiple Numeric question with two subquestions labelled &amp;quot;X&amp;quot; and &amp;quot;Y&amp;quot;.&lt;br /&gt;
#Add the following HTML to the source of the question to create the table:&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;spaceGrid&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td rowspan=&amp;quot;5&amp;quot; class=&amp;quot;yAxisLabel&amp;quot;&amp;gt;How NEGATIVE&amp;lt;br&amp;gt;&lt;br /&gt;
			do you feel about&amp;lt;br&amp;gt;&lt;br /&gt;
		the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td colspan=&amp;quot;5&amp;quot; class=&amp;quot;xAxisLabel&amp;quot;&amp;gt;How POSITIVE do you feel about the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following styles to the end of your template.css file:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.spaceGrid {&lt;br /&gt;
	width: auto;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.spaceGrid td {&lt;br /&gt;
	padding: 0 3px;&lt;br /&gt;
	text-align: center !important;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xAxisLabel {&lt;br /&gt;
	padding-top: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yAxisLabel {&lt;br /&gt;
	padding-right: 10px;&lt;br /&gt;
	width: 125px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xLabel {&lt;br /&gt;
	height: 20px;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yLabel {&lt;br /&gt;
	text-align: right !important;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.gridCell {&lt;br /&gt;
	width: 70px;&lt;br /&gt;
	height: 70px;&lt;br /&gt;
	border: 1px solid #666666;&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.checkedCell {&lt;br /&gt;
	background-color: #66FF00;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of your template.js file:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;	&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
	$(&#039;.spaceGrid&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
		// Define some vars&lt;br /&gt;
		var thisQuestion = $(this).closest(&#039;.numeric-multi&#039;);&lt;br /&gt;
		var thisTable = $(this).closest(&#039;table.spaceGrid&#039;);&lt;br /&gt;
		var numGridCell = $(&#039;.gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numCols = $(&#039;tr:eq(0) .gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numRows = numGridCell/numCols;&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers list&lt;br /&gt;
		$(&#039;.subquestion-list, .questions-list&#039;, thisQuestion).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Initial state&lt;br /&gt;
		var xCoord = $(&#039;input.text:eq(0)&#039;, thisQuestion).val() - 1;&lt;br /&gt;
		var yCoord = numRows - $(&#039;input.text:eq(1)&#039;, thisQuestion).val();&lt;br /&gt;
		$(&#039;tr:eq(&#039;+yCoord+&#039;) .gridCell:eq(&#039;+xCoord+&#039;)&#039;, thisTable).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the grid cells&lt;br /&gt;
		$(&#039;.gridCell&#039;).click(function(){&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Add class to checked cell&lt;br /&gt;
			$(&#039;.checkedCell&#039;, thisQuestion).removeClass(&#039;checkedCell&#039;);&lt;br /&gt;
			$(this).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Find the cell coordinates&lt;br /&gt;
			var reverseRowIndex = (numRows - $(&#039;tr&#039;, thisTable).index($(thisRow)));&lt;br /&gt;
			var colIndex = $(&#039;.gridCell&#039;, thisRow).index($(this)) + 1;&lt;br /&gt;
	&lt;br /&gt;
			// Load coordinates into inputs&lt;br /&gt;
			$(&#039;input.text:eq(0)&#039;, thisQuestion).val(colIndex);&lt;br /&gt;
			$(&#039;input.text:eq(1)&#039;, thisQuestion).val(reverseRowIndex);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The script should automatically handle different grid sizes.&lt;br /&gt;
&lt;br /&gt;
=Slider Highlighting=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may want to highlight a slider after it has been moved/changed to allow respondents to easily see which slider subquestions have been answered.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture.PNG]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;template.js&#039;&#039;&#039;:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(&#039;html&#039;).bind(&#039;slidecreate&#039;, function(event, ui) {&lt;br /&gt;
	$(&#039;.slider_callout&#039;).each(function(i){&lt;br /&gt;
		if($(this).text().length &amp;gt; 0) {&lt;br /&gt;
			$(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	$(&#039;.ui-slider-horizontal&#039;).bind(&#039;slidechange&#039;, function(event, ui) {&lt;br /&gt;
	 $(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and would need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.numeric-multi .answer li {&lt;br /&gt;
	border-bottom: 5px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li label {&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li div.multinum-slider {&lt;br /&gt;
	margin: 1.5em 0.5em 0.2em 0;&lt;br /&gt;
	padding-left: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ui-slider-1 {&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.changedSlider {&lt;br /&gt;
	background-color: #99FFFF;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Dynamic Slider Call-Out Styles=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 9-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is an example of how to insert a custom &#039;&#039;&#039;&#039;&#039;slide()&#039;&#039;&#039;&#039;&#039; function to control the appearance of the slider call-out as the slider is manipulated. In this example the call-out text colour changes as the slider is moved. Sample survey here - [[Media:Dynamic_slider_call_out.lss|dynamic call-out slider survey]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Dynamic_slider_call_out.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
 &lt;br /&gt;
		// Slide function&lt;br /&gt;
		$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function( event, ui ) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), ui.value);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Initial callout states&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), $(this).val());&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Handle the callout style&lt;br /&gt;
		function handleCallout(thisRow, sliderVal) {&lt;br /&gt;
			if(sliderVal &amp;lt; 20) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D90000&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 40) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D96D00&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 60) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D9D900&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#00B22D&#039;);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sliders in Array-Numbers or Array-Dual-Scale-Numbers=&lt;br /&gt;
&lt;br /&gt;
This workaround will replace the dropdowns in &#039;&#039;&#039;&#039;&#039;array-numbers&#039;&#039;&#039;&#039;&#039; or &#039;&#039;&#039;&#039;&#039;array-dual-scale-numbers&#039;&#039;&#039;&#039;&#039; questions with sliders. The sliders will automatically have the same minimum, maximum and steps that you set in the advanced question settings.&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.06==&lt;br /&gt;
[[File:custom_sliders_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; select&#039;).each(function(i, el){&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				var id = $(el).attr(&#039;id&#039;).replace(/#/g,&#039;-&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = Number($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).val());&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).next(&#039;option&#039;).val());&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Insert a container for the slider&lt;br /&gt;
				var container = $(&#039;&amp;lt;div class=&amp;quot;customSliderWrapper&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				var slider = $(&#039;&amp;lt;div id=&amp;quot;slider-&#039;+id+&#039;&amp;quot; class=&amp;quot;customSlider&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo(container).slider({&lt;br /&gt;
					min: firstVal,&lt;br /&gt;
					max: lastVal,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					value: currentVal,&lt;br /&gt;
					step: secondVal - firstVal,&lt;br /&gt;
					slide: function( event, ui ) {&lt;br /&gt;
						$(el).val(ui.value);&lt;br /&gt;
						$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
&lt;br /&gt;
				// Insert a callout&lt;br /&gt;
				var callout = $(&#039;&amp;lt;div id=&amp;quot;callOut-&#039;+id+&#039;&amp;quot; class=&amp;quot;slider_callout slider-callout&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo($(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;)).text($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Set a value as soon as the slider handle is clicked&lt;br /&gt;
				$(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;).mousedown(function() {&lt;br /&gt;
					$(el).val(slider.slider(&#039;value&#039;));&lt;br /&gt;
					$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.customSliderWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 10px;&lt;br /&gt;
	padding-top: 1.75em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey Version 2.6x==&lt;br /&gt;
[[File:Dropdown-sliders.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.64.7 &#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
			&lt;br /&gt;
			// Identify this question&lt;br /&gt;
			var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
			thisQuestion.addClass(&#039;with-dropdown-sliders&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through all array drop-downs&lt;br /&gt;
			$(&#039;select.multiflexiselect&#039;, thisQuestion).each(function(i, el){&lt;br /&gt;
				var thisCell = $(el).closest(&#039;td&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = $(el).val();&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:eq(1)&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
&lt;br /&gt;
				// Insert an input for the slider&lt;br /&gt;
				var thisInput = $(&#039;&amp;lt;input class=&amp;quot;inserted-input&amp;quot; type=&amp;quot;text&amp;quot; /&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
				&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				thisInput.val(currentVal).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: firstVal,&lt;br /&gt;
					&#039;max&#039;: lastVal,&lt;br /&gt;
					&#039;step&#039;: secondVal - firstVal,&lt;br /&gt;
					&#039;value&#039;: Number(currentVal),&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Listener on the slider&lt;br /&gt;
				$(thisInput).on(&#039;slideStop&#039;, function () {&lt;br /&gt;
					if($(&#039;.tooltip&#039;, thisCell).is(&#039;:hidden&#039;)) {&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).show();&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).css(&#039;margin-left&#039;, &#039;-&#039;+($(&#039;.tooltip&#039;, thisCell).width()/2)+&#039;px&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(el).val($(thisInput).val());&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Hide the slider call-out if no value selected yet&lt;br /&gt;
				if(currentVal == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.tooltip&#039;, thisCell).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal {&lt;br /&gt;
    margin: 1.5em auto  1em auto;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey for version 2.6x: [[Media:Demo_Sliders_in_Array_Survey.zip|Demo_Sliders_in_Array_Survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Vertical Sliders=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, 2.00+, IE 9, Firefox 13, Chrome 19&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to apply vertical sliders to multiple-numeric questions. You can download a sample template here (with the plugin in template.js) - [[Media:default_vertical_sliders.zip|vertical slider template]] - and a sample survey here - [[Media:demo_vertical_sliders.lss|vertical slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:verticalsliders_1.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question(s). Do NOT use any of the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js. Replace &amp;quot;QQ&amp;quot; (line 5) with the question ID and adjust the options in the function call as desired. Repeat the call as many times as you need for more questions&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
	// Call the vertical slider plugin with the question ID&lt;br /&gt;
	// Edit options here as desired&lt;br /&gt;
	$(&#039;#questionQQ&#039;).lsVerticalSlider({&lt;br /&gt;
		minValue		:0,		// Minimum value (default 0)&lt;br /&gt;
		maxValue		:200,	// Maximum value (default 100)&lt;br /&gt;
		startValue		:100,	// Start value (default null)&lt;br /&gt;
		step			:10,	// Slider increments (default 1)&lt;br /&gt;
		height			:100,	// Height of slider in pixels (default 200)&lt;br /&gt;
		recordStart		:true,	// Record the start value? (default no)&lt;br /&gt;
		showMin			:true,	// Show minimum value? (default no)&lt;br /&gt;
		showMax			:true	// Show maximum value? (default no)&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
// NO EDITING REQUIRED BELOW HERE&lt;br /&gt;
// A jQuery plugin to convert multiple-numeric questions to vertical sliders&lt;br /&gt;
(function( $ ){&lt;br /&gt;
	$.fn.lsVerticalSlider = function(options) {&lt;br /&gt;
&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			minValue		:0,&lt;br /&gt;
			maxValue		:100,&lt;br /&gt;
			startValue		:&#039;&#039;,&lt;br /&gt;
			step			:1,&lt;br /&gt;
			height			:150,&lt;br /&gt;
			recordStart		:false,&lt;br /&gt;
			showMin			:false,&lt;br /&gt;
			showMax			:false&lt;br /&gt;
		}, options);&lt;br /&gt;
&lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
&lt;br /&gt;
			var $this = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Some classes for the question and subquestions&lt;br /&gt;
			$this.addClass(&#039;vertical-slider-question&#039;);&lt;br /&gt;
			$(&#039;li:[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).addClass(&#039;vertical-slider-subquestion&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through the subquestions&lt;br /&gt;
			$(&#039;li:[id&amp;lt;/div&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).each(function(i){&lt;br /&gt;
				var itemID = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) {&lt;br /&gt;
					opts.startValue = $(&#039;#answer&#039;+itemID).val();&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Insert the slider elements&lt;br /&gt;
				$(&#039;#answer&#039;+itemID).after(&lt;br /&gt;
					&#039;&amp;lt;div class=&amp;quot;vertical-slider-max-min&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-max&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-min&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div id=&amp;quot;vertical-slider-&#039;+itemID+&#039;&amp;quot; class=&amp;quot;vertical-slider&amp;quot; style=&amp;quot;height:&#039;+opts.height+&#039;px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div class=&amp;quot;vertical-slider-callout-wrapper&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-callout&amp;quot; id=&amp;quot;slider-callout-&#039;+itemID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt;&#039;&lt;br /&gt;
				);&lt;br /&gt;
&lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.vertical-slider-max&#039;, $this).text(opts.maxValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.vertical-slider-min&#039;, $this).text(opts.minValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				$(&#039;#vertical-slider-&#039;+itemID).slider({&lt;br /&gt;
					orientation: &#039;vertical&#039;,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					min: opts.minValue,&lt;br /&gt;
					max: opts.maxValue,&lt;br /&gt;
					value: opts.startValue,&lt;br /&gt;
					step: opts.step,&lt;br /&gt;
					slide: function(event, ui) {&lt;br /&gt;
						$(&#039;#answer&#039;+itemID).val(ui.value);&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).text(ui.value);&lt;br /&gt;
						setTimeout(function() {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) }).show();&lt;br /&gt;
						}, 10);&lt;br /&gt;
					},&lt;br /&gt;
					create: function(event, ui) {&lt;br /&gt;
						// Initial values and positions&lt;br /&gt;
						if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) { // Pre-existing answer&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else if(opts.recordStart) { // Record the start value (if option is set)&lt;br /&gt;
							$(&#039;#answer&#039;+itemID).val(opts.startValue);&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).hide();&lt;br /&gt;
						}&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) });&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Vertical slider styles and overrides */&lt;br /&gt;
.vertical-slider-question p.tip {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-subquestion {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 0 3em 0 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question label {&lt;br /&gt;
	display: block;&lt;br /&gt;
	padding: 0 0 0.75em 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question span.input {&lt;br /&gt;
	padding: 0.3em 0 0 0;&lt;br /&gt;
	display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question input.text {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider {&lt;br /&gt;
	float: left;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question .ui-slider-handle {&lt;br /&gt;
	top: auto;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min,&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	position: relative;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	min-width: 3em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min {&lt;br /&gt;
	margin-right: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max,&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	font-size: 0.8em;&lt;br /&gt;
	color:#666666;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max {&lt;br /&gt;
	margin-top: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	right: 0;&lt;br /&gt;
	bottom: 0;&lt;br /&gt;
	margin-bottom: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	top: auto;&lt;br /&gt;
	margin: 0 0 -0.6em 0.5em;&lt;br /&gt;
	padding: 0.1em;&lt;br /&gt;
	font-size: 0.9em;&lt;br /&gt;
	color:#000000;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	background: #F8F8FF;&lt;br /&gt;
	border: 1px solid #D2E0F2;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Range Slider=&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.06==&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert a jQuery UI range slider into a multi-numeric question and automatically populate that question&#039;s inputs with the range min and max values. You can download a sample template here - [[Media:Demo_Range_Slider.zip|range slider template]] - and a sample survey here - [[Media:Limesurvey_survey_range_slider.lss|range slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:Range_slider.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin handles:&lt;br /&gt;
*previous answers&lt;br /&gt;
*slider max/min&lt;br /&gt;
*range min start&lt;br /&gt;
*range max start&lt;br /&gt;
*range span min&lt;br /&gt;
*slider step&lt;br /&gt;
*slider width&lt;br /&gt;
*record the start values&lt;br /&gt;
*show slider max and min&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 1.92 or newer&lt;br /&gt;
*A multiple-numeric question with two subquestions&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question. Do NOT use any of the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A jQuery plugin to display a range slider in LimeSurvey&lt;br /&gt;
(function( $ ){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.lsRangeSlider = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			range			:true, &lt;br /&gt;
			sliderMin		:0, &lt;br /&gt;
			sliderMax		:100,&lt;br /&gt;
			rangeStartMin		:&#039;&#039;,&lt;br /&gt;
			rangeStartMax		:&#039;&#039;,&lt;br /&gt;
			minRangeSpan		:0,&lt;br /&gt;
			step			:1,&lt;br /&gt;
			width			:250, &lt;br /&gt;
			recordStart		:false,&lt;br /&gt;
			showMin			:false,&lt;br /&gt;
			showMax			:false&lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
 &lt;br /&gt;
			if($(this).hasClass(&#039;numeric-multi&#039;) &amp;amp;&amp;amp; $(&#039;input.text&#039;, this).length == 2) {&lt;br /&gt;
 &lt;br /&gt;
				// Define some vars	&lt;br /&gt;
				var $this = $(this);&lt;br /&gt;
				var qID = $(this).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
				var rangeMinInput = $(&#039;input.text:eq(0)&#039;, $this); &lt;br /&gt;
				var rangeMaxInput = $(&#039;input.text:eq(1)&#039;, $this); &lt;br /&gt;
 &lt;br /&gt;
				// Some classes for the question and subquestions&lt;br /&gt;
				$this.addClass(&#039;range-slider-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() != &#039;&#039;) {&lt;br /&gt;
					opts.rangeStartMin = $(rangeMinInput).val();&lt;br /&gt;
					opts.rangeStartMax = $(rangeMaxInput).val();&lt;br /&gt;
				}&lt;br /&gt;
 &lt;br /&gt;
				// Insert the slider elements&lt;br /&gt;
				$(&#039;.subquestions-list&#039;, $this).before(&lt;br /&gt;
					&#039;&amp;lt;div class=&amp;quot;range-slider-wrapper&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;range-slider-min&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div id=&amp;quot;range-slider-&#039;+qID+&#039;&amp;quot; class=&amp;quot;range-slider&amp;quot; style=&amp;quot;width:&#039;+opts.width+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
							&amp;lt;div class=&amp;quot;range-slider-callout&amp;quot; id=&amp;quot;slider-callout-min-&#039;+qID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
							&amp;lt;div class=&amp;quot;range-slider-callout&amp;quot; id=&amp;quot;slider-callout-max-&#039;+qID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;range-slider-max&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div style=&amp;quot;clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt;&#039;&lt;br /&gt;
				);&lt;br /&gt;
 &lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.range-slider-max&#039;, $this).text(opts.sliderMax);&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.range-slider-min&#039;, $this).text(opts.sliderMin);&lt;br /&gt;
				}&lt;br /&gt;
 &lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				var rangeMin;&lt;br /&gt;
				var rangeMax;&lt;br /&gt;
				if(opts.rangeStartMin == &#039;&#039; || opts.rangeStartMin &amp;lt; opts.sliderMin || opts.rangeStartMin &amp;gt; opts.rangeStartMax) {&lt;br /&gt;
					rangeMin = opts.sliderMin+((opts.sliderMax-opts.sliderMin)*0.3333);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					rangeMin = opts.rangeStartMin;&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.rangeStartMax == &#039;&#039; || opts.rangeStartMax &amp;gt; opts.sliderMax || opts.rangeStartMax &amp;lt; opts.rangeStartMin) {&lt;br /&gt;
					rangeMax = opts.sliderMin+((opts.sliderMax-opts.sliderMin)*0.6667);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					rangeMax = opts.rangeStartMax;&lt;br /&gt;
				}&lt;br /&gt;
				$(&#039;#range-slider-&#039;+qID).slider({&lt;br /&gt;
					range: true,&lt;br /&gt;
					min: opts.sliderMin,&lt;br /&gt;
					max: opts.sliderMax, &lt;br /&gt;
					values: [ rangeMin, rangeMax ],&lt;br /&gt;
					step: opts.step,&lt;br /&gt;
					slide: function(event, ui) {&lt;br /&gt;
						if((ui.values[1] - ui.values[0]) &amp;lt; opts.minRangeSpan) {&lt;br /&gt;
							return false; // Nothing happens if less than minRangeSpan&lt;br /&gt;
						}&lt;br /&gt;
						$(rangeMinInput).val(ui.values[0]);&lt;br /&gt;
						$(rangeMaxInput).val(ui.values[1]);&lt;br /&gt;
						$(&#039;#slider-callout-min-&#039;+qID).text(ui.values[0]);&lt;br /&gt;
						$(&#039;#slider-callout-max-&#039;+qID).text(ui.values[1]);&lt;br /&gt;
						setTimeout(function() { &lt;br /&gt;
							$(&#039;#slider-callout-min-&#039;+qID).css({ &#039;left&#039;:$(&#039;.ui-slider-handle:eq(0)&#039;, $this).position().left - $(&#039;#slider-callout-min-&#039;+qID).outerWidth() - ($(&#039;.ui-slider-handle:eq(1)&#039;, $this).outerWidth()/2)+&#039;px&#039; }).show();&lt;br /&gt;
							$(&#039;#slider-callout-max-&#039;+qID).css({ &#039;left&#039;:($(&#039;.ui-slider-handle:eq(1)&#039;, $this).position().left)+($(&#039;.ui-slider-handle:eq(1)&#039;, $this).outerWidth()/2)+&#039;px&#039; }).show();&lt;br /&gt;
						}, 10);&lt;br /&gt;
					},&lt;br /&gt;
					create: function(event, ui) {&lt;br /&gt;
						// Initial values and positions&lt;br /&gt;
						if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMaxInput).val() != &#039;&#039;) { // Pre-existing answer&lt;br /&gt;
							$(&#039;#slider-callout-min-&#039;+qID).text(opts.rangeStartMin);&lt;br /&gt;
							$(&#039;#slider-callout-max-&#039;+qID).text(opts.rangeStartMax);&lt;br /&gt;
						}&lt;br /&gt;
						else if(opts.recordStart &amp;amp;&amp;amp; opts.rangeStartMin &amp;amp;&amp;amp; opts.rangeStartMin &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMaxInput).val() == &#039;&#039;) { // Record the start value (if option is set)&lt;br /&gt;
							$(rangeMinInput).val(opts.rangeStartMin);&lt;br /&gt;
							$(rangeMaxInput).val(opts.rangeStartMax);&lt;br /&gt;
							$(&#039;#slider-callout-min-&#039;+qID).text(opts.rangeStartMin);&lt;br /&gt;
							$(&#039;#slider-callout-max-&#039;+qID).text(opts.rangeStartMax);&lt;br /&gt;
						}&lt;br /&gt;
						else {&lt;br /&gt;
							$(&#039;.range-slider-callout&#039;, $this).hide();&lt;br /&gt;
						} &lt;br /&gt;
						$(&#039;#slider-callout-min-&#039;+qID).css({ &#039;left&#039;:$(&#039;.ui-slider-handle:eq(0)&#039;, $this).position().left - $(&#039;#slider-callout-min-&#039;+qID).outerWidth() - ($(&#039;.ui-slider-handle:eq(1)&#039;, $this).outerWidth()/2)+&#039;px&#039; });&lt;br /&gt;
						$(&#039;#slider-callout-max-&#039;+qID).css({ &#039;left&#039;:($(&#039;.ui-slider-handle:eq(1)&#039;, $this).position().left)+($(&#039;.ui-slider-handle:eq(1)&#039;, $this).outerWidth()/2)+&#039;px&#039; });&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template but easily modified for others):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.range-slider-question p.tip,&lt;br /&gt;
.range-slider-question .subquestions-list {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-wrapper {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	margin: 10px 0;&lt;br /&gt;
	padding-top: 20px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider,&lt;br /&gt;
.range-slider-max,&lt;br /&gt;
.range-slider-min {&lt;br /&gt;
	float: left;&lt;br /&gt;
	position: relative;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-max,&lt;br /&gt;
.range-slider-min {&lt;br /&gt;
	font-size: 0.8em;&lt;br /&gt;
	color:#666666;&lt;br /&gt;
	line-height: 1.20;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-min {&lt;br /&gt;
	margin-right: 5px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-max {&lt;br /&gt;
	margin-left: 5px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-question .ui-slider-handle {&lt;br /&gt;
	top: -4px;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-callout {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	top: -30px;&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	min-width: 1.3em;&lt;br /&gt;
	padding: 0.1em;&lt;br /&gt;
	font-size: 0.9em;&lt;br /&gt;
	color:#000000;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	background: #F8F8FF;&lt;br /&gt;
	border: 1px solid #D2E0F2;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider({&lt;br /&gt;
			sliderMin	:0,	// Minimum slider value (default 0)&lt;br /&gt;
			sliderMax	:100,	// Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:20,	// Minimum range handle start value  &lt;br /&gt;
			rangeStartMax	:80,	// Maximum range handle start value  &lt;br /&gt;
			minRangeSpan	:5,	// Minimum allowed range span &lt;br /&gt;
			step		:1,	// Slider increments (default 1)&lt;br /&gt;
			width		:400,	// Width of slider in pixels (default 250)&lt;br /&gt;
			recordStart	:true,	// Record the start value? (default no)&lt;br /&gt;
			showMin		:true,	// Show slider minimum value? (default no)&lt;br /&gt;
			showMax		:true	// Show slider maximum value? (default no)&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Or, to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider();&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert a jQuery UI range slider into a multi-numeric question and automatically populate that question&#039;s inputs with the range min and max values.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039;: [[Media:Demo_Range_Slider_2.5x.zip|Sample Template and Survey.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_Range_Slider_2.5x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin handles:&lt;br /&gt;
*previous answers&lt;br /&gt;
*slider max/min&lt;br /&gt;
*range min start&lt;br /&gt;
*range max start&lt;br /&gt;
*range span min&lt;br /&gt;
*slider step&lt;br /&gt;
*record the start values&lt;br /&gt;
*show slider max and min&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;LimeSurvey 2.5x&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A multiple-numeric question with two subquestions&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create your multi-numeric question. Do NOT use any of the slider advanced settings.&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A jQuery plugin to display a range slider in LimeSurvey&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.lsRangeSlider = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:100, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:&#039;&#039;, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:&#039;&#039;, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:false, // Record the start value? (default no)&lt;br /&gt;
			showMin			:false, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:false // Show slider maximum value? (default no)&lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
 &lt;br /&gt;
			if($(this).hasClass(&#039;numeric-multi&#039;) &amp;amp;&amp;amp; $(&#039;input.text&#039;, this).length == 2) {&lt;br /&gt;
 &lt;br /&gt;
				// Define some vars	&lt;br /&gt;
				var thisQuestion = $(this);&lt;br /&gt;
				var rangeMinInput = $(&#039;input.text.form-control:eq(0)&#039;, thisQuestion); &lt;br /&gt;
				var rangeMaxInput = $(&#039;input.text.form-control:eq(1)&#039;, thisQuestion); &lt;br /&gt;
				thisQuestion.addClass(&#039;range-slider-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() != &#039;&#039;) {&lt;br /&gt;
					opts.rangeStartMin = $(rangeMinInput).val();&lt;br /&gt;
					opts.rangeStartMax = $(rangeMaxInput).val();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					if(opts.rangeStartMin == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMin = opts.sliderMin;&lt;br /&gt;
					}&lt;br /&gt;
					if(opts.rangeStartMax == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMax = opts.sliderMax;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
		&lt;br /&gt;
				// Insert the slider&lt;br /&gt;
				var insertedEls = &#039;&amp;lt;div class=&amp;quot;col-xs-12 col-sm-12 withslider&amp;quot;&amp;gt;\&lt;br /&gt;
										&amp;lt;input class=&amp;quot;inserted-slider&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;rangeSlider&amp;quot; /&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-left&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-min&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-right&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-max&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;].form-control:eq(0)&#039;, thisQuestion).closest(&#039;.subquestion-list&#039;).hide().before(insertedEls);&lt;br /&gt;
				&lt;br /&gt;
				var sliderValues = [Number(opts.rangeStartMin), Number(opts.rangeStartMax)];&lt;br /&gt;
			&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: Number(opts.sliderMin),&lt;br /&gt;
					&#039;max&#039;: Number(opts.sliderMax),&lt;br /&gt;
					&#039;step&#039;: Number(opts.step),&lt;br /&gt;
					&#039;range&#039;: true,&lt;br /&gt;
					&#039;value&#039;: sliderValues,&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider .tooltip&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
						&lt;br /&gt;
				// Listener on the range slider&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slideStart&#039;, function(event, ui) {&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slide slideStop&#039;, function(event, ui) {&lt;br /&gt;
					var thisLowerVal = Number($.trim($(this).val().split(&#039;,&#039;)[0]));&lt;br /&gt;
					var thisUpperVal = Number($.trim($(this).val().split(&#039;,&#039;)[1]));&lt;br /&gt;
					if(opts.minRangeSpan &amp;gt; 0 &amp;amp;&amp;amp; (thisUpperVal-thisLowerVal) &amp;lt; opts.minRangeSpan) {&lt;br /&gt;
						$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider(&#039;setValue&#039;, sliderValues);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(thisLowerVal);&lt;br /&gt;
						$(rangeMaxInput).val(thisUpperVal);&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
						sliderValues = [thisLowerVal, thisUpperVal];&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
 &lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.inserted-slider-min&#039;, thisQuestion).text(opts.sliderMin);&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.inserted-slider-max&#039;, thisQuestion).text(opts.sliderMax);&lt;br /&gt;
				}&lt;br /&gt;
				&lt;br /&gt;
				// Handle recordStart&lt;br /&gt;
				if(opts.recordStart) {&lt;br /&gt;
					if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[0])));&lt;br /&gt;
						$(rangeMaxInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[1])));&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider({&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:10, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:2, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:8, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:true, // Record the start value? (default no)&lt;br /&gt;
			showMin			:true, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:true // Show slider maximum value? (default no)&lt;br /&gt;
		});&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Or, to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider();&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Reverse Slider=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 7-10, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is an example of how to insert a custom &#039;&#039;&#039;&#039;&#039;slide()&#039;&#039;&#039;&#039;&#039; function to reverse the slider.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Reverse_slider.lss.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Caveats:&lt;br /&gt;
*Developed for LS 2.05&lt;br /&gt;
*The &amp;quot;Reset&amp;quot; button will not work&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function reverseSlider(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Identify the question&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
 &lt;br /&gt;
	//$(&#039;span.input&#039;, thisQuestion).show() // un-comment this to debug&lt;br /&gt;
 &lt;br /&gt;
	// Reverse the min/max displays&lt;br /&gt;
	$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var showMinText = $(&#039;.slider-showmin&#039;, this).text();&lt;br /&gt;
		var showMaxText = $(&#039;.slider-showmax&#039;, this).text();&lt;br /&gt;
		$(&#039;.slider-showmin&#039;, this).text(showMaxText);&lt;br /&gt;
		$(&#039;.slider-showmax&#039;, this).text(showMinText);&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial slider positions&lt;br /&gt;
	$(&#039;span.input input[type=&amp;quot;text&amp;quot;]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
 &lt;br /&gt;
		if($(this).val() != &#039;&#039;) {				&lt;br /&gt;
			var thisRow = $(this).closest(&#039;li.answer-item&#039;);				&lt;br /&gt;
			var thisSlider = $(&#039;.ui-slider&#039;, thisRow);&lt;br /&gt;
			var sliderValue = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;)+$(thisSlider).slider(&#039;option&#039;, &#039;min&#039;)-$(this).val();&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisRow).slider(&#039;option&#039;, &#039;value&#039;, sliderValue);&lt;br /&gt;
			$(&#039;.slider-callout&#039;, thisRow).text($(this).val()); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// New slide function&lt;br /&gt;
	$(&#039;.ui-slider&#039;, thisQuestion).slider( &#039;option&#039;, &#039;slide&#039;, function(event, ui) {		&lt;br /&gt;
		// Define a few vars&lt;br /&gt;
		var thisRow = $(this).closest(&#039;li.answer-item&#039;);&lt;br /&gt;
		var thisSlider = $(this);&lt;br /&gt;
		var step = $(thisSlider).slider(&#039;option&#039;, &#039;step&#039;).toString();&lt;br /&gt;
		var stepDecimals = &#039;&#039;;&lt;br /&gt;
		if(step.indexOf(&#039;.&#039;) != -1) {&lt;br /&gt;
			stepDecimals = step.length - (step.indexOf(&#039;.&#039;)+1);&lt;br /&gt;
		}&lt;br /&gt;
		var reverseValue = &#039;&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Calculate the &amp;quot;reverse&amp;quot; value&lt;br /&gt;
		if(ui.value &amp;gt; $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;)) {&lt;br /&gt;
			reverseValue = $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else if(ui.value &amp;lt; $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;)) {&lt;br /&gt;
			reverseValue = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else if(stepDecimals &amp;gt; 0) { // Handle decimal places&lt;br /&gt;
			reverseValue = ($(thisSlider).slider(&#039;option&#039;, &#039;max&#039;)+$(thisSlider).slider(&#039;option&#039;, &#039;min&#039;)-ui.value).toFixed(stepDecimals);&lt;br /&gt;
		}&lt;br /&gt;
		else{&lt;br /&gt;
			reverseValue = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;)+$(thisSlider).slider(&#039;option&#039;, &#039;min&#039;)-ui.value;&lt;br /&gt;
		}&lt;br /&gt;
		reverseValue = reverseValue.toString();&lt;br /&gt;
		reverseValue = reverseValue.replace(/\./,LSvar.sLEMradix);&lt;br /&gt;
 &lt;br /&gt;
		// Load the callout&lt;br /&gt;
		$(&#039;.slider_callout&#039;, thisRow).text(reverseValue);&lt;br /&gt;
 &lt;br /&gt;
		// Set the data value&lt;br /&gt;
		$(&#039;input.text&#039;, thisRow).val(reverseValue);&lt;br /&gt;
		$(&#039;input.text&#039;, thisRow).triggerHandler(&amp;quot;keyup&amp;quot;);&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add this script to the source of every question you want to &amp;quot;reverse&amp;quot;:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
    $(document).ready(function() { 	&lt;br /&gt;
		reverseSlider({QID});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sliders With Control Buttons=&lt;br /&gt;
== Version 2.05 ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 7-10, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert &amp;quot;up&amp;quot; and &amp;quot;down&amp;quot; buttons to control sliders. You can download a sample template here - [[Media:Demo_Slider_Buttons.zip|slider with buttons template]] - and a sample survey here - [[Media:Limesurvey_survey_button_slider.lss|button slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:Button_slider.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin allows the following options:&lt;br /&gt;
*Down Text: Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
*Up Text: Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
*Scrolling: Continuous slider movement if the left mouse button is held down&lt;br /&gt;
*Scroll Interval: Interval (in milliseconds) between slider movement when button is held down (do not make this too short or it will be difficult to stop the slider accurately)&lt;br /&gt;
*Value Prefix: Prefix for call-out&lt;br /&gt;
*Value Suffix: Suffix for call-out&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A custom plugin to add control buttons to LimeSurvey sliders&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.sliderButtons = function(options) {&lt;br /&gt;
	&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
		downText: &#039;-&#039;,		// Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
		upText: &#039;+&#039;,		// Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
		scrolling: true,	// Continuous slider movement if left mouse button held down&lt;br /&gt;
		scrollInterval: 150,// Interval (in ms) between slider movement when button is held down&lt;br /&gt;
		valuePrefix: &#039;&#039;,	// Prefix for callout&lt;br /&gt;
		valueSuffix: &#039;&#039;	// Suffix for callout&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function(i) {&lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
	&lt;br /&gt;
			// Add some classes&lt;br /&gt;
			$(thisQuestion).addClass(&#039;slider-button-question&#039;);		&lt;br /&gt;
			&lt;br /&gt;
			// Insert the buttons&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;slider-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button down&amp;quot;&amp;gt;&#039;+opts.downText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button up&amp;quot;&amp;gt;&#039;+opts.upText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
														&amp;lt;/div&amp;gt;&#039;);			&lt;br /&gt;
			&lt;br /&gt;
			// Initial button states&lt;br /&gt;
			function handleButtonState(slider) {&lt;br /&gt;
				var thisRow = $(slider).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSliderVal = $(slider).slider(&#039;option&#039;, &#039;value&#039;);&lt;br /&gt;
				var thisSliderStep = $(slider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var thisSliderMin = $(slider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(slider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisRow).prop(&#039;disabled&#039;, false);&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMin) {&lt;br /&gt;
					$(&#039;button.slider-button.down&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMax) {&lt;br /&gt;
					$(&#039;button.slider-button.up&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				handleButtonState(this);	&lt;br /&gt;
				if($(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val() != &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider-callout&#039;, this).text(opts.valuePrefix+$(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val()+opts.valueSuffix);&lt;br /&gt;
				}&lt;br /&gt;
			});	&lt;br /&gt;
			&lt;br /&gt;
			// Function to handle button actions&lt;br /&gt;
			function handleButtons(thisButton) {&lt;br /&gt;
				var thisRow = $(thisButton).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSlider = $(&#039;.multinum-slider&#039;, thisRow);&lt;br /&gt;
				var thisSliderStep = $(thisSlider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var stepDecimals = 0;&lt;br /&gt;
				if(thisSliderStep.toString().indexOf(&#039;.&#039;) &amp;gt;= 0) {&lt;br /&gt;
					stepDecimals = thisSliderStep.toString().split(&#039;.&#039;)[1].length;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSliderVal = Number($(thisSlider).slider(&#039;option&#039;, &#039;value&#039;)).toFixed(stepDecimals);&lt;br /&gt;
				var thisSliderMin = $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;down&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;gt; thisSliderMin) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)-Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;up&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;lt; thisSliderMax) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)+Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				var newValue = $(thisSlider).slider(&#039;option&#039;, &#039;value&#039;).toFixed(stepDecimals).replace(/\./, LSvar.sLEMradix);&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(newValue).triggerHandler(&#039;keyup&#039;);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisSlider).text(opts.valuePrefix+newValue+opts.valueSuffix);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Scrolling&lt;br /&gt;
			if(opts.scrolling == true) {&lt;br /&gt;
					&lt;br /&gt;
				var sliderTimeout;&lt;br /&gt;
				var clicker = $(&#039;button.slider-button&#039;, thisQuestion);&lt;br /&gt;
				var count = 0;&lt;br /&gt;
&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mousedown(function(){&lt;br /&gt;
					var thisButton = $(this);&lt;br /&gt;
					sliderTimeout = setInterval(function(){&lt;br /&gt;
						handleButtons(thisButton);&lt;br /&gt;
					}, opts.scrollInterval);				&lt;br /&gt;
					return false;&lt;br /&gt;
				});				&lt;br /&gt;
				&lt;br /&gt;
				$(document).mouseup(function(){&lt;br /&gt;
					clearInterval(sliderTimeout);&lt;br /&gt;
					return false;&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mouseout(function(){&lt;br /&gt;
					handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Listener on the buttons&lt;br /&gt;
			$(&#039;button.slider-button&#039;, thisQuestion).click(function(e) {&lt;br /&gt;
				handleButtons(this)	;		&lt;br /&gt;
				handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on sliders&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function( event, ui ) {&lt;br /&gt;
				handleButtonState(this);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on reset buttons&lt;br /&gt;
			$(&#039;.slider-reset&#039;, thisQuestion).on( &amp;quot;click&amp;quot;, function( event, ui ) {&lt;br /&gt;
				var thisReset = $(this);&lt;br /&gt;
				setTimeout(function() {&lt;br /&gt;
					handleButtonState($(thisReset).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				}, 150);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template but easily modified for others):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.slider-button-question label.slider-label {&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    padding: 40px 1em 0 0;&lt;br /&gt;
    *padding: 25px 1em 0 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question div.multinum-slider {&lt;br /&gt;
	margin-top: 45px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .ui-slider-horizontal .ui-slider-handle {&lt;br /&gt;
	width: 18px;&lt;br /&gt;
    margin-left: -9px;&lt;br /&gt;
    top: -4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider_callout {&lt;br /&gt;
    margin-left: -41px;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
    width: 100px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 40px 0 0 25px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button {&lt;br /&gt;
	padding: 0 10px;&lt;br /&gt;
	margin: 0 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button:disabled {&lt;br /&gt;
	opacity:0.65;&lt;br /&gt;
	filter:alpha(opacity=65);&lt;br /&gt;
	cursor: default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-reset {&lt;br /&gt;
	margin-top: 42px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons({&lt;br /&gt;
			downText: &#039;Down&#039;, // Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
			upText: &#039;Up&#039;, // Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
			scrolling: true, // Continuous slider movement if left mouse button held down&lt;br /&gt;
			scrollInterval: 250, // Interval (in ms) between slider movement when button is held down&lt;br /&gt;
			valueSuffix: &amp;quot;%&amp;quot;	// Suffix for callout&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Or, simply to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons();&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Slider Control Buttons for LimeSurvey 3.x can be found here - https://github.com/tpartner/LimeSurvey-Slider-Controls-3x&lt;br /&gt;
&lt;br /&gt;
=Limit the language options dropdown on the list surveys page=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note: This feature is implemented in Version 2.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This solution allows you to define (in config.php) a comma-delimited list of languages you want in the dropdown.  It is not optimized (it loads all the languages and then unsets everything you don&#039;t want), but is fairly easy to implement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$supportedLanguagesKeys = &#039;en,vi&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Filter out everything except the your selected languages (if defined).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // if $supportedLanguagesKeys is defined in config, filter&lt;br /&gt;
&lt;br /&gt;
   if (!empty($GLOBALS[&#039;supportedLanguagesKeys&#039;]))&lt;br /&gt;
&lt;br /&gt;
   foreach (array_keys($supportedLanguages) as $lang) {&lt;br /&gt;
&lt;br /&gt;
     if (!in_array($lang, explode(&#039;,&#039;, $GLOBALS[&#039;supportedLanguagesKeys&#039;]))) {&lt;br /&gt;
&lt;br /&gt;
       unset($supportedLanguages[$lang]);&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now only my languages, plus the base language, is displayed. To get rid of the redundant base language, do the following&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
   } elseif (!isset($surveyid))&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       global $defaultlang, $baselang;&lt;br /&gt;
&lt;br /&gt;
       $htmlcode = &amp;quot;&amp;lt;select name=\&amp;quot;select\&amp;quot; class=&#039;languagechanger&#039; onchange=\&amp;quot;javascript:window.location=this.value\&amp;quot;&amp;gt;\n&amp;quot;;&lt;br /&gt;
#    REMOVE THE NEXT LINE OR COMMENT IT OUT)&lt;br /&gt;
&lt;br /&gt;
       $htmlcode .= &amp;quot;&amp;lt;option value=\&amp;quot;$relativeurl/index.php?lang=&amp;quot;. $defaultlang .&amp;quot;$tokenparam\&amp;quot;&amp;gt;&amp;quot;.getLanguageNameFromCode($defaultlang,false).&amp;quot;&amp;lt;/option&amp;gt;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   foreach(getlanguagedata() as $key=&amp;gt;$val)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           $htmlcode .= &amp;quot;\t&amp;lt;option value=\&amp;quot;$relativeurl/index.php?lang=&amp;quot;.$key.&amp;quot;$tokenparam\&amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
           if ($key == $baselang) $htmlcode .= &amp;quot; selected=&#039;selected&#039;&amp;quot;; /* ADD THIS TO SET SELECTION */&lt;br /&gt;
&lt;br /&gt;
           $htmlcode .= &amp;quot;&amp;gt;&amp;quot;.getLanguageNameFromCode($key,false).&amp;quot;&amp;lt;/option&amp;gt;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       $htmlcode .= &amp;quot;&amp;lt;/select&amp;gt;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Basically it just pre-selects the base language from the list.&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=127150</id>
		<title>Workarounds: Question design, layout and templating</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Question_design,_layout_and_templating&amp;diff=127150"/>
		<updated>2018-10-12T14:44:29Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Version 2.5 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This section more or less deals with styling your survey, adjusting the layout and setting up special question types. You can find &#039;&#039;&#039;similar information&#039;&#039;&#039; at these pages:&lt;br /&gt;
* [[The template editor]]&lt;br /&gt;
* [[Workarounds: Manipulating a survey at runtime using Javascript]]&lt;br /&gt;
* [[Workarounds: Survey behaviour]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves. &amp;lt;span style=&#039;color:#EE0000&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
= Get rid of the question mark (help.gif)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.80+ (6536)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get rid of the question mark symbol that LimeSurvey displays at the end of a question, you can either upload an empty help.gif into the template folder (as discussed in the forum) or you can use the Template editor: Open the &#039;&#039;template.css&#039;&#039; of your template and search for &#039;&#039;div.questionhelp img&#039;&#039;, then add a &#039;&#039;visibility:hidden;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It will look something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
div.questionhelp img  {&lt;br /&gt;
  margin:5px;&lt;br /&gt;
  visibility:hidden;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also &#039;&#039;&#039;replace the image&#039;&#039;&#039; by following [[The template editor#Replacing the help icon|these instructions]].&lt;br /&gt;
&lt;br /&gt;
=Require users to check a box agreeing to privacy statement before registering for a survey=&lt;br /&gt;
&lt;br /&gt;
If you need to have users positively acknowledge a privacy statement before submitting a registration form, the following will help you do this.&lt;br /&gt;
&lt;br /&gt;
It involves a minor modification to common.php in versions up to 1.85. Later versions may not require this.&lt;br /&gt;
&lt;br /&gt;
Edit common.php and look for the line (at approximately line 3014)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$registerform .= &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;input class=&#039;submit&#039; type=&#039;submit&#039; value=&#039;&amp;quot;.$clang-&amp;gt;gT(&amp;quot;Continue&amp;quot;).&amp;quot;&#039; /&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and change it to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$registerform .= &amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;input id=&#039;registercontinue&#039; class=&#039;submit&#039; type=&#039;submit&#039; value=&#039;&amp;quot;.$clang-&amp;gt;gT(&amp;quot;Continue&amp;quot;).&amp;quot;&#039; /&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then save common.php. This gives you DOM access to the &amp;quot;continue&amp;quot; button on the register form, but will have no other practical effect or change to LimeSurvey&#039;s operations.&lt;br /&gt;
&lt;br /&gt;
Next, you need to edit the template you are using (see the documentation on the Template editor if you don&#039;t know how to do this).&lt;br /&gt;
&lt;br /&gt;
In the template editor, open the screen &amp;quot;Register page&amp;quot; and select the file &amp;quot;register.pstpl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
There are two modifications you need to make to this file. The first is to add the following code after the line that says &#039;&#039;{REGISTERFORM}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code disables the &amp;quot;Continue&amp;quot; button so that nobody can process the registration form until they&#039;ve clicked the checkbox.&lt;br /&gt;
&lt;br /&gt;
The second modification to make is to be done between the lines {REGISTERMESSAGE2} and {REGISTERFORM}. Add:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&lt;br /&gt;
 &amp;lt;label&amp;gt; Accept&lt;br /&gt;
   &amp;lt;input type=&#039;radio&#039;&lt;br /&gt;
          name=&amp;quot;privacy&amp;quot;&lt;br /&gt;
          value=&amp;quot;YES&amp;quot;&lt;br /&gt;
          onChange=&amp;quot;if(this.checked) {&lt;br /&gt;
                      document.getElementById(&#039;registercontinue&#039;).disabled=false;&lt;br /&gt;
                    }&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/label&amp;gt;&lt;br /&gt;
 &amp;lt;label&amp;gt;I don&#039;t accept&lt;br /&gt;
   &amp;lt;input type=&#039;radio&#039;&lt;br /&gt;
          name=&amp;quot;privacy&amp;quot;&lt;br /&gt;
          value=&amp;quot;NO&amp;quot;&lt;br /&gt;
          CHECKED&lt;br /&gt;
          onChange=&amp;quot;if(this.checked) {&lt;br /&gt;
                      document.getElementById(&#039;registercontinue&#039;).disabled=true;&lt;br /&gt;
                    }&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/label&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the users will have to agree to whatever text you replace &amp;quot;Do you agree to privacy stuff?&amp;quot; before they continue on and register.&lt;br /&gt;
&lt;br /&gt;
(Thanks to &#039;&#039;Pippo_Jedi&#039;&#039; for helping work this out)&lt;br /&gt;
&lt;br /&gt;
=Different progress indicator=&lt;br /&gt;
&lt;br /&gt;
==Version 1.87 and later:==&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will find the progress value and insert it into the element following the progress bar.&lt;br /&gt;
&lt;br /&gt;
It should be pointed out that I had to introduce a delay in firing the function because the progress value is not calculated until after template.js is called. The delay is set at 1/10 of a second but you may be able to reduce that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // Display progress value&lt;br /&gt;
&lt;br /&gt;
   function setProgValue() {&lt;br /&gt;
&lt;br /&gt;
       var progress = $(&#039;#progressbar&#039;).attr(&#039;aria-valuenow&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).text(progress+&#039;%&#039;).show();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#progress-post&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
       setTimeout(&#039;setProgValue()&#039;,100);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to hide the &amp;quot;0%&amp;quot; before the progress bar, add the following to the end of template.css:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#progress-pre {&lt;br /&gt;
&lt;br /&gt;
   display: none;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Delete unwanted gaps in question title=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When copying data (questions, answers, ...) from MS Word or other applications into the editor there might occur some gaps in the question title.&lt;br /&gt;
&lt;br /&gt;
There are two solutions to this:&lt;br /&gt;
# Use popup mode and manually delete unwanting extra html tags (requires html knowledge).&lt;br /&gt;
# Disable paste word feature: Tweak your limesurvey-config.js file in limesurvey/admin/scripts/fckeditor.26 and set the following option to true:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;FCKConfig.ForcePasteAsPlainText = true ;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that clear you browser cache and try again.&lt;br /&gt;
&lt;br /&gt;
=How to change the &amp;lt;font-size&amp;gt; tags using CSS=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This workaround was deleted because it is outdated. Such changes can be done by [[The template editor#Styling questions with CSS|adjusting template.css]] of your template.&lt;br /&gt;
&lt;br /&gt;
=Question type variation: Scale with bars (one and two sided)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some methodogical issues to think about: Very often a common scale as 1 to 5 or -2 to +2 fits all needs, as the shown subject is clearly defined as positive or negative. As soon as you would reduce the influence from the question and scale on the respondent, you will need something neutral to determine tendences, emphases and so on.&lt;br /&gt;
&lt;br /&gt;
So I put up a new variation of the one and two sided array question:&lt;br /&gt;
&lt;br /&gt;
ttp://www.limesurvey.org/images/fbfiles/images/example_bar_scale.jpg&lt;br /&gt;
&lt;br /&gt;
In my example the left side reads &amp;quot;strategical planning&amp;quot; and the right side &amp;quot;operative business&amp;quot;. None of these are purely negative or positive, so the bars only show in which direction the balancing point moves.&lt;br /&gt;
&lt;br /&gt;
To realize a question as shown above just do as follows:&lt;br /&gt;
&lt;br /&gt;
Set up as many bars as you will need (in my example there are four different bars in total) with a graphic program like PAINT .NET, GIMP or similar ones (yes, you may also use commercial software like Photoshop). To prevent the bars from looking twitchy, designate the size in advance. I did one bar 60x15 px, one 45x15px, one 30x15px and at last 15x15px. Save them as PNG, JPG or GIF.&lt;br /&gt;
# Create a new label set within Lime. Call it whatever you like.&lt;br /&gt;
# Enter a code number at first, then press the pencil symbol to enter the editor.&lt;br /&gt;
#Press the &amp;quot;Insert / edit image&amp;quot; button and upload the bar you want to insert with the FCK upload tool. Then choose the uploaded picture, save and leave the FCK editor.&lt;br /&gt;
#The row in the lable editor now shows an &amp;lt;img&amp;gt;-tag which refers to your bar picture.&lt;br /&gt;
#Repeat the above described steps as often as needed to build up your bar scale.&lt;br /&gt;
&lt;br /&gt;
=Doing a Likert Scale=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A Likert Scale is a special type of the Semantic Differential question where several item shall be rated on different scales, each marked at the beginning and at the end with opposite statements. &lt;br /&gt;
&lt;br /&gt;
To do this in LimeSurvey just follow these steps:&lt;br /&gt;
#Create a label set with values from 0 to 7 (for the classic Likert Scale - feel free to choose other ranges).&lt;br /&gt;
#Create a new question and choose Array (Flexible Labels) as question type.&lt;br /&gt;
#Assign the Likert Scale label set to this question.&lt;br /&gt;
#Enter your answers as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;DIV style=&amp;quot;white-space: nowrap;&amp;quot;&amp;gt;ITEM statement1|statement2&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The white-space style is to avoid line breaks which would ruin the whole scale. feel free to insert non-breakable spaces between the ITEM and statement1 to define the margin between these to strings.&lt;br /&gt;
&lt;br /&gt;
=Alternate background colour of questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To alternate the background colour of questions, open the &#039;&#039;template.css&#039;&#039; of your template with the Template Editor or a text editor and modify the &#039;&#039;Question styles&#039;&#039; section to include the following style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
div#question2 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question4 td.questiontext,&lt;br /&gt;
&lt;br /&gt;
div#question6 td.questiontext {&lt;br /&gt;
&lt;br /&gt;
   background-color: #E0EBF8;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to apply the style to all of the questions you would like modified using their question IDs (&#039;&#039;question2, question4, question6&#039;&#039; in this case). Question IDs are displayed when creating or editing questions - see below:&lt;br /&gt;
&lt;br /&gt;
[[File:qid_1_493x173.gif]]&lt;br /&gt;
&lt;br /&gt;
Here the question ID is #question80 .&lt;br /&gt;
&lt;br /&gt;
=Embedding audio in questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7191), IE 7, FireFox 3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Audio clips can be embedded in most question text or answer text. In this example, using the default template, I&#039;ve embedded clips into the answers of an &#039;&#039;&#039;&#039;&#039;Array (Yes/No/Uncertain)&#039;&#039;&#039;&#039;&#039; question to ask respondents how they feel about some sounds. The resulting question will look like this.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x202.gif]]&lt;br /&gt;
&lt;br /&gt;
It&#039;s accomplished by placing the following code in each of the answers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;embed height=&amp;quot;20&amp;quot; width=&amp;quot;128&amp;quot; autostart=&amp;quot;false&amp;quot; controls=&amp;quot;console&amp;quot;&lt;br /&gt;
&lt;br /&gt;
loop=&amp;quot;true&amp;quot; volume=&amp;quot;50&amp;quot; src=&amp;quot;{TEMPLATEURL}audio_1.mp3&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some notes about the code:&lt;br /&gt;
*The &#039;&#039;audio_1.mp3&#039;&#039; part will be different for each answer (it&#039;s the audio file name).&lt;br /&gt;
*In this case the audio files are residing in the template folder being used for this survey (that&#039;s where &#039;&#039;{TEMPLATEURL}&#039;&#039; points to) but they can be placed anywhere if you use an absolute URL in the &#039;&#039;src&#039;&#039; parameter - something like &#039;&#039;src=&amp;quot;http://mysite.com/audio/audio_1.mp3&amp;quot;&#039;&#039;&lt;br /&gt;
*If the audio file doesn&#039;t exist where the &#039;&#039;src&#039;&#039; parameter indicates, the player will not appear.&lt;br /&gt;
*You&#039;ll need to insert the code into the answers using the source screen - click on &amp;quot;Edit answers&amp;quot;, click the pencil beside the text box, click &amp;quot;Source&amp;quot; in the pop-up, enter the code and save it with the little diskette icon.&lt;br /&gt;
*You may need to turn off the XSS filter - see the documentation for [http://docs.limesurvey.org/tiki-index.php?page=Global+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Security Global settings].&lt;br /&gt;
&lt;br /&gt;
Although the above example places the audio in the answer text of the question, the same principles can be used to place it in the question text itself. Something like this perhaps.&lt;br /&gt;
&lt;br /&gt;
[[File:audioTest_595x154.gif]]&lt;br /&gt;
&lt;br /&gt;
=Hiding inputs of a &amp;quot;Multiple options with comments&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&lt;br /&gt;
&lt;br /&gt;
There may be times when you want to hide some of the input boxes of a &#039;&#039;&#039;&#039;&#039;Multiple options with comments&#039;&#039;&#039;&#039;&#039; question as in the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:hidden_inputs_541x168.gif]]&lt;br /&gt;
&lt;br /&gt;
This can be accomplished with CSS (see [[The template editor#Styling questions with CSS|Styling questions in LimeSurvey 1.8]]). For each input that you want to hide, add the following style to your template.css file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#answer11111X22X33Acomment {&lt;br /&gt;
   display: none;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Where 11111 is your survey ID, 22 is your group ID, 33 is your question ID and A is the answer code.&lt;br /&gt;
&lt;br /&gt;
Note that you will still see columns for the hidden inputs in your data but they will be empty.&lt;br /&gt;
&lt;br /&gt;
=Multiple question types in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90 - 1.92+, IE 7/8/9, Firefox 13, Safari 5, Chrome 10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Media:limesurvey_survey_62584.lss|Download the sample survey]]&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present multiple question types in what appears to be an array - as depicted in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=62584&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here] (download the sample survey - [[Media:limesurvey_survey_62584.lss|limesurvey_survey_62584.lss]]). This example uses the default template but should be adaptable to any template using divisions for question containers.&lt;br /&gt;
&lt;br /&gt;
[[File:inline_questions_700x228.png]]&lt;br /&gt;
&lt;br /&gt;
Basically what we do is take groups of questions (5 in this case), wrap them in a division and make them line up nicely horizontally and vertically. The width of the survey is also fixed to prevent wrapping issues. We do this with a JavaScript/jQuery function that inserts the necessary wrappers and then modifies styles so everything behaves properly. The top row is 5 boilerplate questions with the &amp;quot;column headers&amp;quot; as question text (the first just has a blank space). The following rows are a boilerplate with the &amp;quot;row headers&amp;quot; followed by 4 assorted questions.&lt;br /&gt;
&lt;br /&gt;
It should be noted that using conditions on these questions may result in unexpected behavior. If a question is hidden by conditions, the question(s) to the right of it will move over to take its place.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Create your questions keeping in mind how they will lay out when grouped into rows (in this example - boilerplate, yes/no, short text, numeric, dropdown, and repeat).&lt;br /&gt;
#In the source of the first boilerplate question add the function below (see [http://manual.limesurvey.org/wiki/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F How to use script]).&lt;br /&gt;
#Modify the number of rows, number of columns and the start placement in the function call (line 6) as required (the example uses 4 rows and 5 columns and the &amp;quot;array&amp;quot; starts with the third question on the page).&lt;br /&gt;
&lt;br /&gt;
The code may look intimidating at first but it&#039;s actually fairly simple. I&#039;ve laid it out as sequentially as possible and purposely used few shortcuts and many comments to make it easier to follow.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
*If you use question types other than boilerplate, short text, list dropdown, numeric or yes-no, you&#039;ll need to add to the last section of code, where it hides the question text and formats the inputs for display this way.&lt;br /&gt;
*Any extra questions on the page should follow this grid of questions, not precede them.&lt;br /&gt;
* If you use boilerplate as question type you should add after:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
the following 2 lines&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
//repair boilerplate questioncells&lt;br /&gt;
$(&#039;div.boilerplate td.questiontext&#039;).parent().show();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Javascript code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the &amp;quot;sideBySide&amp;quot; function with number of rows, columns and start position&lt;br /&gt;
		sideBySide(4, 5, 3);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function sideBySide(rows, columns, startQuestion) {&lt;br /&gt;
&lt;br /&gt;
		/*********** Display multiple questions side by side ***********/&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;div.qRow1&#039;).length == 0) {&lt;br /&gt;
&lt;br /&gt;
			var rowNum = 0;&lt;br /&gt;
			var colNum = 1;&lt;br /&gt;
			var rowList = new Array();&lt;br /&gt;
&lt;br /&gt;
			//////// Add question classes for later use ////////&lt;br /&gt;
&lt;br /&gt;
			// Loop through all questions and add row and column specific classes&lt;br /&gt;
			$(&#039;div[id^=&amp;quot;question&amp;quot;]&#039;).each(function(i) {&lt;br /&gt;
				if(i &amp;gt;= (startQuestion-1) &amp;amp;&amp;amp; rowNum &amp;lt; rows) { // This IF condition only needed if there are questions before or following the &amp;quot;inline&amp;quot; questions&lt;br /&gt;
					$(this).addClass(&#039;qRow&#039;+rowNum+&#039;&#039;).addClass(&#039;qCol&#039;+colNum+&#039;&#039;).addClass(&#039;inlineQuestion&#039;);&lt;br /&gt;
					if(rowNum == 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;columnLabel&#039;);&lt;br /&gt;
					}  &lt;br /&gt;
					if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum == 1) {&lt;br /&gt;
						$(this).addClass(&#039;rowLabel&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else if(rowNum &amp;gt; 0 &amp;amp;&amp;amp; colNum &amp;gt; 1) {&lt;br /&gt;
						$(this).addClass(&#039;questionCell&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					if(colNum == columns) {&lt;br /&gt;
						rowList.push(&#039;qRow&#039;+rowNum+&#039;&#039;);&lt;br /&gt;
						rowNum++;&lt;br /&gt;
						colNum = 1;&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						colNum++;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).addClass(&#039;normalQuestion&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Survey layout manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Fix the width of the survey&lt;br /&gt;
			$(&#039;table.outerframe&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;900px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Wrap each &amp;quot;row&amp;quot; in a wrapper div&lt;br /&gt;
			$(rowList).each(function(i) {&lt;br /&gt;
				$(&#039;.&#039;+this+&#039;&#039;).wrapAll(&#039;&amp;lt;div id=&amp;quot;inlineWrapper&#039;+i+&#039;&amp;quot; class=&amp;quot;inlineRow&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Style the wrapper divs&lt;br /&gt;
			$(&#039;.inlineRow&#039;).css({&lt;br /&gt;
				&#039;width&#039;: &#039;850px&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0 auto 0 auto&#039;,&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.inlineRow:first&#039; ).css({&lt;br /&gt;
				&#039;margin-top&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get all the questions to sit politely side by side&lt;br /&gt;
			$( &#039;.inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;float&#039;: &#039;left&#039;,&lt;br /&gt;
				&#039;height&#039;:&#039;41px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;-8px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;.inlineQuestion .questionhelp&#039; ).hide();&lt;br /&gt;
			$( &#039;.inlineQuestion .survey-question-help&#039; ).parent().hide();&lt;br /&gt;
		   &lt;br /&gt;
			// A little space under the last row&lt;br /&gt;
			$( &#039;.inlineRow:last .inlineQuestion&#039; ).css({&lt;br /&gt;
				&#039;margin-bottom&#039;: &#039;10px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Any questions not displayed inline (this is only needed if there are questions following the &amp;quot;inline&amp;quot; questions)&lt;br /&gt;
			$( &#039;.normalQuestion&#039; ).css({&lt;br /&gt;
				&#039;clear&#039;: &#039;both&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Column manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Set the column widths - can be set individually if necessary&lt;br /&gt;
			// Must add up to less than 100%&lt;br /&gt;
			$( &#039;.qCol1&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;12%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;.qCol2, .qCol3, .qCol4, .qCol5&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;22%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			//////// Question manipulation ////////&lt;br /&gt;
&lt;br /&gt;
			// Hide the answer element in boilerplate questions&lt;br /&gt;
			$( &#039;div.boilerplate td.answer&#039; ).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Hide the question text elements in non-boilerplate questions&lt;br /&gt;
			$(&#039;div.questionCell td.questiontext&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
			// Push the question tables to 100%&lt;br /&gt;
			$( &#039;div.inlineRow table&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;100%&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get everything to line up nicely vertically&lt;br /&gt;
			$( &#039;.inlineQuestion td.questiontext, .inlineQuestion td.answer p&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Adjust cell heights so everything lines up nicely horizontally&lt;br /&gt;
			$( &#039;.inlineQuestion td.answer, .inlineQuestion td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;35px&#039;,&lt;br /&gt;
				&#039;overflow&#039;:&#039;hidden&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;0.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;#inlineWrapper0 .inlineQuestion&#039; ).css({ &#039;height&#039;:&#039;50px&#039; });&lt;br /&gt;
			$( &#039;#inlineWrapper0 td.questiontext&#039; ).css({&lt;br /&gt;
				&#039;height&#039;:&#039;50px&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Yes-no question styles&lt;br /&gt;
			$( &#039;div.yes-no ul&#039; ).css({&lt;br /&gt;
				&#039;text-align&#039;: &#039;center&#039;,&lt;br /&gt;
				&#039;font-size&#039;: &#039;90%&#039;,&lt;br /&gt;
				&#039;margin&#039;: &#039;0&#039;,&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;5px&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no li&#039; ).css({&lt;br /&gt;
				&#039;padding-right&#039;: &#039;1.5em&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.yes-no td.answer&#039; ).css({&lt;br /&gt;
				&#039;padding-bottom&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Short-text question styles&lt;br /&gt;
			$( &#039;div.text-short input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Numeric question styles&lt;br /&gt;
			$( &#039;div.numeric input&#039; ).css({&lt;br /&gt;
				&#039;width&#039;: &#039;125px&#039;,&lt;br /&gt;
				&#039;margin-left&#039;: &#039;0&#039;&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div.numeric p.tip&#039; ).css({&lt;br /&gt;
				&#039;display&#039;: &#039;none&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Get rid of the margins around select boxes&lt;br /&gt;
			$( &#039;p.question&#039; ).css({ &#039;margin&#039;:&#039;0&#039; });&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Star Rating System=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://www.fyneworks.com/jquery/star-rating/ jQuery Star Rating Plugin] to display a series of stars that are used to generate a rating value. This value is then passed to either a hidden numeric input question or a hidden list radio question. Both methods are outlined below - use one or both depending on whether you want to use [Assessments|assessments].&lt;br /&gt;
&lt;br /&gt;
The plugin uses a series of radio inputs to generate the stars (more about these below). It allows the use of whole or partial stars as shown in [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en this demo] and the image below.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x324.png]]&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using Numeric Input Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like your rating data to be collected as a numeric value and don&#039;t want to use [[Assessments|LimeSurvey assessments]] - it&#039;s a little easier to implement. There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en here] (first question).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#[http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
##jquery.MetaData.js&lt;br /&gt;
##jquery.rating.css&lt;br /&gt;
##jquery.rating.js&lt;br /&gt;
##delete.gif&lt;br /&gt;
##star.gif&lt;br /&gt;
#In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a numeric input question and then in the source of the question add as many radio inputs as star segments. For example, if you would like 5 stars, each with half-segments (as in the demo Q1), you would need 10 radio inputs and that would give rating values from 1-10.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q1 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;6&amp;quot; value=&amp;quot;6&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;7&amp;quot; value=&amp;quot;7&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;8&amp;quot; value=&amp;quot;8&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;9&amp;quot; value=&amp;quot;9&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;10&amp;quot; value=&amp;quot;10&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. A note on split stars. The stars in the above example are split in half by the &#039;&#039;{ split:2 }&#039;&#039; metadata. So if you don&#039;t want split stars, your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
7. Finally, in the source of the question add the following function after your inputs. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the numeric input and pass the rating values into it as they are changed. If the rating is canceled the numeric input is nullified. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingNumeric(11111, 22, 1); handleRatingNumeric(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingNumeric (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the numeric input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val();&lt;br /&gt;
&lt;br /&gt;
   if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answer&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + &#039;&#039;).val(rating);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the numeric question&lt;br /&gt;
&lt;br /&gt;
handleRatingNumeric (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Star Rating System Using List (Radio) Question==&lt;br /&gt;
&lt;br /&gt;
Use this method if you would like to use [[Assessments|assessments]]. There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=47586&amp;amp;newtest=Y&amp;amp;lang=en here] (second question).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
&lt;br /&gt;
2. Set up the template to use custom onload functions. (See the [[Workarounds: Manipulating a survey at runtime using Javascript#Custom onload function|workaround here]])&lt;br /&gt;
&lt;br /&gt;
3. [http://www.fyneworks.com/jquery/star-rating/ Download the plugin] and place the following included files in your template folder:&lt;br /&gt;
*jquery.MetaData.js&lt;br /&gt;
*jquery.rating.css&lt;br /&gt;
*jquery.rating.js&lt;br /&gt;
*delete.gif&lt;br /&gt;
*star.gif&lt;br /&gt;
&lt;br /&gt;
4. In the &amp;lt;head&amp;gt; section of your startpage.pstpl, add the following code to link to the files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.rating.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.MetaData.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}jquery.rating.css&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Create a list (radio) question with the same amount of sequentially numbered answers as star ratings. For example, if you want 5 whole-stars, you would create 5 answers, as in the image below, and this would give you ratings from 1-5. Note that the &amp;quot;Codes&amp;quot; and &amp;quot;Answers&amp;quot; must be sequential numbers.&lt;br /&gt;
&lt;br /&gt;
[[File:star_rating_700x156_v2.png]]&lt;br /&gt;
&lt;br /&gt;
6. In the list (radio) question, set the [[Advanced question settings|hide_tip]] question attribute to 1&lt;br /&gt;
&lt;br /&gt;
7. In the source of the question add as many radio inputs as star segments. So 5 whole-stars (as in the demo Q2), would need 5 radio inputs.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t confuse these inputs with the actual question, they are just for the plugin&#039;s use.&lt;br /&gt;
&lt;br /&gt;
At this point your question source code should look something like below. Make sure that all inputs have the same name. Each input must have the same title as value and these must be sequential. Don&#039;t worry about how all of this looks in the WSYSWYG editor - the plugin is going to hide these inputs and replace them with stars.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q2 - Some question text here.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;starContainer&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;2&amp;quot; value=&amp;quot;2&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;3&amp;quot; value=&amp;quot;3&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;4&amp;quot; value=&amp;quot;4&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star&amp;quot; title=&amp;quot;5&amp;quot; value=&amp;quot;5&amp;quot; name=&amp;quot;q2Rate&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. A note on split stars. The stars in the above example are whole-stars. If you want them split you need to add metadata to the class - something like &#039;&#039;{ split:2 }&#039;&#039;. So if you want half-stars your inputs would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:2 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
And stars split into third-segments would look like:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;input type=&amp;quot;radio&amp;quot; class=&amp;quot;star { split:3 }&amp;quot; title=&amp;quot;1&amp;quot; value=&amp;quot;1&amp;quot; name=&amp;quot;q1Rate&amp;quot; /&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
9. Finally, in the source of the question add the following function after your inputs. (See [http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure;=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ How to use script here])&lt;br /&gt;
&lt;br /&gt;
Some notes on the code:&lt;br /&gt;
*Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
*The code will hide the question radio buttons and toggle them as the rating values are changed. If the rating is canceled all question inputs are unchecked. If a respondent navigates away from the page then returns the code &amp;quot;remembers&amp;quot; the previous rating and displays the stars accordingly.&lt;br /&gt;
*If you want to apply it to more numeric questions on the same page simply add more calls with the appropriate IDs. (eg. handleRatingRadio(11111, 22, 1); handleRatingRadio(11111, 22, 2); ...) .&lt;br /&gt;
&lt;br /&gt;
Onload code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
function handleRatingRadio (sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
   // Hide the radio input&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; td.answer&#039;).parent().hide();&lt;br /&gt;
&lt;br /&gt;
   // Get a previous rating (if any) and use it to initialize the star display&lt;br /&gt;
&lt;br /&gt;
   var rating = $(&#039;#question&#039; + qID + &#039; input.radio[checked=true]&#039;).attr(&#039;value&#039;);&lt;br /&gt;
&lt;br /&gt;
   //if ( rating != &#039;&#039; ) {&lt;br /&gt;
&lt;br /&gt;
   if ( rating ) {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.star&#039;).rating(&#039;select&#039;, rating);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating cancel element&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.rating-cancel&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Nullify the rating if the Cancel element is clicked&lt;br /&gt;
&lt;br /&gt;
       rating = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Listener on the star rating elements&lt;br /&gt;
&lt;br /&gt;
   $(&#039;#question&#039; + qID + &#039; div.star-rating&#039;).click(function(event) {&lt;br /&gt;
&lt;br /&gt;
       // Find the value of the highest clicked star and pass it into the text input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; div.star-rating-on&#039;).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
           rating = $(this).children(&#039;a&#039;).html( );&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039; + qID + &#039; input.radio[value=&#039; + rating + &#039;]&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Call the function for the radio question&lt;br /&gt;
&lt;br /&gt;
handleRatingRadio (SSSSS, GG, QQ);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable column widths in array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7557), IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define all column widths of an array question - as shown in the image below and [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here]. This example uses the default template shipped with 7557 but should be adaptable to any template.&lt;br /&gt;
&lt;br /&gt;
[[File:array_widths_701x226.gif]]&lt;br /&gt;
&lt;br /&gt;
We use a function to remove all of the widths imposed by the core code and then insert our own.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation is as follows:&#039;&#039;&#039;&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure;=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects documentation here]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Replace all instances of QQ with the question ID.&lt;br /&gt;
#In the third section of code, adjust the widths and add/remove columns as necessary. This example is for an array with a question text column followed by 3 answer columns as shown above.&lt;br /&gt;
#In the final section adjust the question text alignment to your liking&lt;br /&gt;
&lt;br /&gt;
Onload code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // Get rid of all the widths that the API imposes&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question col&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question thead td&#039; ).attr(&#039;width&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define a width for the question table so we can do so for its children&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Keep this to 95% or less so IE will behave&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question&#039; ).attr(&#039;width&#039;, &#039;95%&#039;);&lt;br /&gt;
&lt;br /&gt;
   // Define the column widths&lt;br /&gt;
&lt;br /&gt;
   // Add or remove columns and adjust widths as necessary but widths should add up to 100%&lt;br /&gt;
&lt;br /&gt;
   // NOTE: Columns must be sequentially numbered starting at 0 - eg, td:eq(0), td:eq(1), td:eq(2).....&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th:eq(0)&#039; ).css({ &#039;width&#039;:&#039;10%&#039; }); // Answer text column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(0)&#039; ).css({ &#039;width&#039;:&#039;50%&#039; }); // First answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(1)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Second answer column&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody td:eq(2)&#039; ).css({ &#039;width&#039;:&#039;20%&#039; }); // Third answer column&lt;br /&gt;
&lt;br /&gt;
   // Push the text input widths to 95% of their parent containers&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question input[type=&amp;quot;text&amp;quot;]&#039; ).css({ &#039;width&#039;:&#039;95%&#039; });&lt;br /&gt;
&lt;br /&gt;
   // Align the answer text - feel free to experiment&lt;br /&gt;
&lt;br /&gt;
   $( &#039;div#questionQQ table.question tbody th&#039; ).css({&#039;text-align&#039;:&#039;center&#039;});&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use images for radio buttons and checkboxes=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.92/2.0, using IE 9, FireFox 13, Chrome 16, Safari 5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses an adaptation of the jQuery imagetick.js plugin to replace the default radio buttons and checkboxes with images as pictured below:&lt;br /&gt;
&lt;br /&gt;
[[File:images.png]] &lt;br /&gt;
&lt;br /&gt;
This adaptation will work in the following question types:&lt;br /&gt;
*Array&lt;br /&gt;
*Array by column&lt;br /&gt;
*Array dual scale&lt;br /&gt;
*Array (5 point choice)&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
*Array (Increase-Same-Decrease)&lt;br /&gt;
*Array (Yes-No-Uncertain)&lt;br /&gt;
*Gender&lt;br /&gt;
*Yes-No&lt;br /&gt;
*Multiple choice&lt;br /&gt;
*Multiple choice with comments&lt;br /&gt;
*5 point choice&lt;br /&gt;
*List (Radio)&lt;br /&gt;
*List with comment&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey 1.92 and earlier implementation==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Download [[Media:imagetick_lime_v1.3.zip|this modified version of the plugin]].&lt;br /&gt;
#Extract all files and place them in your template directory.&lt;br /&gt;
#Add the following line to the &amp;lt;head&amp;gt; element in your startpage.pstpl &#039;&#039;&#039;BEFORE&#039;&#039;&#039; the call for template.js:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}imagetick_lime.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the source of a question or the group description&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		var templatePath = $(&#039;head link[href*=&amp;quot;template.css&amp;quot;]&#039;).attr(&#039;href&#039;).replace(/template.css/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Apply images to radios&lt;br /&gt;
		$(&#039;input[type=&amp;quot;radio&amp;quot;]&#039;).imageTick({&lt;br /&gt;
&lt;br /&gt;
			// Image to use as a selected state of the radio&lt;br /&gt;
			tick_image_path:  templatePath+&amp;quot;radio.gif&amp;quot;,&lt;br /&gt;
			// Image to use as a non-selected state&lt;br /&gt;
			no_tick_image_path:  templatePath+&amp;quot;no_radio.gif&amp;quot;,&lt;br /&gt;
			// Class to apply to all radio images that are dynamically created&lt;br /&gt;
			image_tick_class: &amp;quot;radios&amp;quot;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Apply images to checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;).imageTick({&lt;br /&gt;
&lt;br /&gt;
			// Image to use as a selected state of the checkbox&lt;br /&gt;
			tick_image_path: templatePath+&amp;quot;check.gif&amp;quot;,&lt;br /&gt;
			// Image to use as a non-selected state&lt;br /&gt;
			no_tick_image_path: templatePath+&amp;quot;no_check.gif&amp;quot;,&lt;br /&gt;
			// Class to apply to all checkbox images that are dynamically created&lt;br /&gt;
			image_tick_class: &amp;quot;checkboxes&amp;quot;&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#You can also call the imagetick function from template.js. Skip the last step above and add the following to the end of template.js. Replace &amp;quot;yourTemplateName&amp;quot; with your template directory name.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
	var templatePath = $(&#039;head link[href*=&amp;quot;template.css&amp;quot;]&#039;).attr(&#039;href&#039;).replace(/template.css/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
	// Apply images to radios&lt;br /&gt;
	$(&#039;input[type=&amp;quot;radio&amp;quot;]&#039;).imageTick({&lt;br /&gt;
&lt;br /&gt;
		// Image to use as a selected state of the radio&lt;br /&gt;
		tick_image_path: templatePath+&amp;quot;radio.gif&amp;quot;,&lt;br /&gt;
		// Image to use as a non-selected state&lt;br /&gt;
		no_tick_image_path: templatePath+&amp;quot;no_radio.gif&amp;quot;,&lt;br /&gt;
		// Class to apply to all radio images that are dynamically created&lt;br /&gt;
		image_tick_class: &amp;quot;radios&amp;quot;&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	// Apply images to checkboxes&lt;br /&gt;
	$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;).imageTick({&lt;br /&gt;
&lt;br /&gt;
		// Image to use as a selected state of the checkbox&lt;br /&gt;
		tick_image_path: templatePath+&amp;quot;check.gif&amp;quot;,&lt;br /&gt;
		// Image to use as a non-selected state&lt;br /&gt;
		no_tick_image_path: templatePath+&amp;quot;no_check.gif&amp;quot;,&lt;br /&gt;
		// Class to apply to all checkbox images that are dynamically created&lt;br /&gt;
		image_tick_class: &amp;quot;checkboxes&amp;quot;&lt;br /&gt;
	});&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
If you want to apply it to only one question on a page use selector (where QQ is the question ID)&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#questionQQ input[type=&amp;quot;radio&amp;quot;]&#039;)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
If you want to apply it to a single radio button in a question (to maybe have different images for each option) use selector (where SSSSS is the survey ID, GG is the group ID, QQ is the question ID, AA is the answer code)&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&amp;quot;input#answerSSSSSXGGXQQAA&amp;quot;)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey 2.0 and later implementation==&lt;br /&gt;
&lt;br /&gt;
Follow the instructions above with these changes:&lt;br /&gt;
#Download [[Media:Imagetick_lime_v2.1.zip|this modified version of the plugin for 2.0 and up]] instead of the one mentioned above and add all contained files to your template directory.&lt;br /&gt;
#Add these lines to the &amp;lt;head&amp;gt; element in your startpage.pstpl instead of the one above:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}imagetick_lime_2.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;{TEMPLATEURL}imagetick_lime_2.css&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thanks to Jordan Boesch for the original plugin.&lt;br /&gt;
&lt;br /&gt;
=Changing the position and layout of an individual question using &amp;quot;question code&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (6536)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use this very flexible workaround you first have to apply a minor change to the question.pstpl of the used template.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
needs to be changed to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;survey-question&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;div class=&amp;quot;survey-question-text&amp;quot; id=&amp;quot;{QUESTION_CODE}&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this change won&#039;t change anything in the layout and can be left in the template even if you don&#039;t need this workaround. It&#039;s just a means to have a handle to actually change individual questions.&lt;br /&gt;
&lt;br /&gt;
You can then use a code such as the following in the question text to make question specific format changes. &amp;quot;SAMPLE&amp;quot; needs to be replaced with the concerning question code and javascript has to be allowed ([[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|older versions of limesurvey]], under global settings for newer versions).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.borderTop= &amp;quot;0px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginTop= &amp;quot;-62px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;SAMPLE&#039;).style.marginLeft= &amp;quot;30px&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This sample code will hide the border at the top of the question, will move the whole question up by 62px and to the right by 30px. Using this workaround you can change a whole a lot of things concerning format and positions of a specific question without changing all the questions. A (German) list of all the allowed options can be found [http://de.selfhtml.org/javascript/objekte/style.htm#style_eigenschaften here].&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
==Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Assign a label set to the question - these will be the labels in the center column.&lt;br /&gt;
#Set the second parameter of the function call to true for randomized rows.&lt;br /&gt;
#Adjust the styles in lines 21-24 as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The script moves the question columns into the MaxDiff configuration and disables the opposing radio element when a selection is made.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
	&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, false);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
	function maxDiff(qID, randomize) {&lt;br /&gt;
		&lt;br /&gt;
		// Random number between 1 and 2&lt;br /&gt;
		// Math.floor(Math.random() * (max - min + 1)) + min;&lt;br /&gt;
		var randomNum = Math.floor(Math.random() * ((2-1)+1) + 1);&lt;br /&gt;
&lt;br /&gt;
		// Move the columns&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col:eq(1)&#039;).prependTo(&#039;colgroup.col-responses&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list thead tr:eq(0) th:eq(0)&#039;).prependTo(&#039;#question&#039;+qID+&#039; table.question thead tr:eq(0)&#039;);&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
			$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Random rows&lt;br /&gt;
		if(randomize) {&lt;br /&gt;
			var rowsArr = [];&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr&#039;).each(function(i){&lt;br /&gt;
				$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
				rowsArr.push(i);&lt;br /&gt;
			});&lt;br /&gt;
			shuffleArray(rowsArr);&lt;br /&gt;
			$(rowsArr).each(function(i){&lt;br /&gt;
				$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody&#039;).append($(&#039;#question&#039;+qID+&#039; tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Style stuff&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list col.odd&#039;).css({ &#039;background-color&#039;:&#039;transparent&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody th&#039;).css({ &#039;text-align&#039;:&#039;center&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:even td, #question&#039;+qID+&#039; table.question tbody tr:even th&#039;).css({ &#039;background-color&#039;:&#039;#F1F1F1&#039; });&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; table.subquestions-list tbody tr:odd td, #question&#039;+qID+&#039; table.question tbody tr:odd th&#039;).css({ &#039;background-color&#039;:&#039;#FCFCFC&#039; });&lt;br /&gt;
&lt;br /&gt;
		// Prevent clicking twice in the same row&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input.radio&#039;).on(&#039;click&#039;, function () {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio&#039;).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.radio:checked&#039;).each(function(i) {&lt;br /&gt;
				var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
				$(&#039;input.radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function shuffleArray(array) {&lt;br /&gt;
		for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
			var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
			var temp = array[i];&lt;br /&gt;
			array[i] = array[j];&lt;br /&gt;
			array[j] = temp;&lt;br /&gt;
		}&lt;br /&gt;
		return array;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Versions 2.5 and 3.x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:MaxDiff_2.5.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Template.zip|Demo template]]&lt;br /&gt;
* [[Media:Demo_MaxDiff_For_25_Survey.zip|Demo survey]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question with 2 &amp;quot;answers&amp;quot; - these will be the left and right columns.&lt;br /&gt;
#Add 2 subquestions to the array - these will be the left and right columns.&lt;br /&gt;
#Add answers to the array - these will be the rows.&lt;br /&gt;
#Create a copy the default template.&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.js&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function maxDiff(qID, randomize) {&lt;br /&gt;
 &lt;br /&gt;
	// Identify some elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisTable = $(&#039;table.subquestion-list:eq(0)&#039;, thisQuestion);&lt;br /&gt;
 &lt;br /&gt;
	// Assign a new question class&lt;br /&gt;
	$(thisQuestion).addClass(&#039;max-diff-array&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Move the columns&lt;br /&gt;
	$(&#039;thead tr:eq(0)&#039;, thisTable).prepend($(&#039;thead tr:eq(0) th:eq(1)&#039;, thisTable));&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
		$(&#039;td.answer-item:eq(0)&#039;, this).prependTo(this);&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Random rows&lt;br /&gt;
	if(randomize) {&lt;br /&gt;
		var rowsArr = [];&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisTable).each(function(i){&lt;br /&gt;
			$(this).attr(&#039;data-index&#039;, i);&lt;br /&gt;
			rowsArr.push(i);&lt;br /&gt;
		});&lt;br /&gt;
		shuffleArray(rowsArr);&lt;br /&gt;
		$(rowsArr).each(function(i){&lt;br /&gt;
			$(&#039;tbody&#039;, thisTable).append($(&#039;tr[data-index=&amp;quot;&#039;+this+&#039;&amp;quot;]&#039;, thisTable));&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	// Prevent clicking twice in the same row&lt;br /&gt;
	$(&#039;input:radio&#039;, thisQuestion).on(&#039;click&#039;, function () {&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;input:radio&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		$(&#039;input:radio:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr.answers-list&#039;);&lt;br /&gt;
			$(&#039;input:radio&#039;, thisRow).not(this).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		});&lt;br /&gt;
	});	&lt;br /&gt;
 &lt;br /&gt;
	// Fix up the row classes&lt;br /&gt;
	var rowClass = 1;&lt;br /&gt;
	$(&#039;tr.answers-list&#039;, thisTable).each(function(i) {&lt;br /&gt;
		$(this).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;&#039;&#039;template.css&#039;&#039;&#039;&#039;&#039; in your new template:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.max-diff-array th.answertext { &lt;br /&gt;
	text-align: center;&lt;br /&gt;
	border-right: 3px solid #FFFFFF;&lt;br /&gt;
	border-left: 3px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
/* Override the responsive &amp;quot;no-more-tables&amp;quot; stuff */&lt;br /&gt;
@media only screen and (max-width: 801px) {&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables table {&lt;br /&gt;
		display: table;&lt;br /&gt;
		border-collapse: inherit;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables thead, &lt;br /&gt;
	.max-diff-array .no-more-tables tbody {&lt;br /&gt;
		display: table-row-group;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables tr {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		position: relative;&lt;br /&gt;
		top: auto;&lt;br /&gt;
		display: table-row;&lt;br /&gt;
		border: 0 none;&lt;br /&gt;
	}	&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .no-more-tables th, &lt;br /&gt;
	.max-diff-array .no-more-tables td {&lt;br /&gt;
		display: table-cell;&lt;br /&gt;
		text-align: center !important;&lt;br /&gt;
		color: #2c3e50;&lt;br /&gt;
		font-size: 15px;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array th.answertext { &lt;br /&gt;
		border-right: 3px solid #FFFFFF;&lt;br /&gt;
		border-left: 3px solid #FFFFFF;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	.max-diff-array .answer-item label span {&lt;br /&gt;
		display: none !important;&lt;br /&gt;
	}	&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add a script like this to the question source of the Array (flexible labels) question:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	   &lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		// Call the maxDiff() function&lt;br /&gt;
		// Set the second parameter to true for randomized rows&lt;br /&gt;
		maxDiff({QID}, true);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Load SVG Code From Drawing Tool=&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to load a drawing tool and store the results in a huge-text question. The details are outlined in the [[Workarounds: Manipulating a survey at runtime using Javascript#Load SVG Code From Drawing Tool|JavaScript section of the workarounds]].&lt;br /&gt;
&lt;br /&gt;
=Minimum or Maximum Date in Datepicker=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note: From version 2.05 beta6, you MUST set the minimum and maximum date for the date picker directly in the advanced question attributes of the date/time question. This workaround will seize to work.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can set the minimum or maximum selectible date in a datepicker as follows&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]] and add the following to the source of the date question text or help. Replace &amp;quot;QQ&amp;quot; with the date question ID.&lt;br /&gt;
&lt;br /&gt;
For a minimum date of April 15, 2010:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date(2010, 4-1, 15) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a minimum date of the current date (today):&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;minDate&#039;, new Date() );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a maximum date of May 10, 2015:&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       var qID = QQ;&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question&#039;+qID+&#039; .popupdate&#039;).datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date(2015, 5-1, 10) );&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More details here - http://jqueryui.com/demos/datepicker/#option-minDate&lt;br /&gt;
&lt;br /&gt;
=Evaluative Space Grid (ESG)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 &amp;amp; 2.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The evaluative space grid (ESG) is a two-dimensional grid that provides a single-item measure of positivity and negativity (Larsen et al, 2009). See [http://leeds-faculty.colorado.edu/mcgrawp/pdf/larsen.norris.mcgraw.hawkley.cacioppo.2009.pdf page 4 of this PDF].&lt;br /&gt;
&lt;br /&gt;
This can be accomplished using a multiple-numeric question, some simple HTML and a little JavaScript.&lt;br /&gt;
&lt;br /&gt;
A table can be shown in the question. When a respondent clicks a grid cell in the table JavaScript loads the coordinates of the cell into the multiple-numeric question inputs.&lt;br /&gt;
&lt;br /&gt;
[[File:Space_grid_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create a Multiple Numeric question with two subquestions labelled &amp;quot;X&amp;quot; and &amp;quot;Y&amp;quot;.&lt;br /&gt;
#Add the following HTML to the source of the question to create the table:&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table class=&amp;quot;spaceGrid&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td rowspan=&amp;quot;5&amp;quot; class=&amp;quot;yAxisLabel&amp;quot;&amp;gt;How NEGATIVE&amp;lt;br&amp;gt;&lt;br /&gt;
			do you feel about&amp;lt;br&amp;gt;&lt;br /&gt;
		the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;yLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;gridCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;Not at all&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Slightly&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Moderately&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Quite a bit&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;xLabel&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;yLabel&amp;quot;&amp;gt;Extremely&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td class=&amp;quot;blankCell&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
		&amp;lt;td colspan=&amp;quot;5&amp;quot; class=&amp;quot;xAxisLabel&amp;quot;&amp;gt;How POSITIVE do you feel about the stimulus?&amp;lt;/td&amp;gt;&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following styles to the end of your template.css file:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.spaceGrid {&lt;br /&gt;
	width: auto;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
	border-collapse: collapse;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.spaceGrid td {&lt;br /&gt;
	padding: 0 3px;&lt;br /&gt;
	text-align: center !important;&lt;br /&gt;
	border: 0 none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xAxisLabel {&lt;br /&gt;
	padding-top: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yAxisLabel {&lt;br /&gt;
	padding-right: 10px;&lt;br /&gt;
	width: 125px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.xLabel {&lt;br /&gt;
	height: 20px;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.yLabel {&lt;br /&gt;
	text-align: right !important;&lt;br /&gt;
	font-weight: normal;&lt;br /&gt;
	font-size: 13px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.gridCell {&lt;br /&gt;
	width: 70px;&lt;br /&gt;
	height: 70px;&lt;br /&gt;
	border: 1px solid #666666;&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
td.checkedCell {&lt;br /&gt;
	background-color: #66FF00;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of your template.js file:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;	&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
	$(&#039;.spaceGrid&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
		// Define some vars&lt;br /&gt;
		var thisQuestion = $(this).closest(&#039;.numeric-multi&#039;);&lt;br /&gt;
		var thisTable = $(this).closest(&#039;table.spaceGrid&#039;);&lt;br /&gt;
		var numGridCell = $(&#039;.gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numCols = $(&#039;tr:eq(0) .gridCell&#039;, thisTable).length;&lt;br /&gt;
		var numRows = numGridCell/numCols;&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers list&lt;br /&gt;
		$(&#039;.subquestion-list, .questions-list&#039;, thisQuestion).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Initial state&lt;br /&gt;
		var xCoord = $(&#039;input.text:eq(0)&#039;, thisQuestion).val() - 1;&lt;br /&gt;
		var yCoord = numRows - $(&#039;input.text:eq(1)&#039;, thisQuestion).val();&lt;br /&gt;
		$(&#039;tr:eq(&#039;+yCoord+&#039;) .gridCell:eq(&#039;+xCoord+&#039;)&#039;, thisTable).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the grid cells&lt;br /&gt;
		$(&#039;.gridCell&#039;).click(function(){&lt;br /&gt;
			var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Add class to checked cell&lt;br /&gt;
			$(&#039;.checkedCell&#039;, thisQuestion).removeClass(&#039;checkedCell&#039;);&lt;br /&gt;
			$(this).addClass(&#039;checkedCell&#039;);&lt;br /&gt;
	&lt;br /&gt;
			// Find the cell coordinates&lt;br /&gt;
			var reverseRowIndex = (numRows - $(&#039;tr&#039;, thisTable).index($(thisRow)));&lt;br /&gt;
			var colIndex = $(&#039;.gridCell&#039;, thisRow).index($(this)) + 1;&lt;br /&gt;
	&lt;br /&gt;
			// Load coordinates into inputs&lt;br /&gt;
			$(&#039;input.text:eq(0)&#039;, thisQuestion).val(colIndex);&lt;br /&gt;
			$(&#039;input.text:eq(1)&#039;, thisQuestion).val(reverseRowIndex);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The script should automatically handle different grid sizes.&lt;br /&gt;
&lt;br /&gt;
=Slider Highlighting=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may want to highlight a slider after it has been moved/changed to allow respondents to easily see which slider subquestions have been answered.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture.PNG]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of &#039;&#039;&#039;template.js&#039;&#039;&#039;:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(&#039;html&#039;).bind(&#039;slidecreate&#039;, function(event, ui) {&lt;br /&gt;
	$(&#039;.slider_callout&#039;).each(function(i){&lt;br /&gt;
		if($(this).text().length &amp;gt; 0) {&lt;br /&gt;
			$(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
	$(&#039;.ui-slider-horizontal&#039;).bind(&#039;slidechange&#039;, function(event, ui) {&lt;br /&gt;
	 $(this).parents(&#039;li:eq(0)&#039;).addClass(&#039;changedSlider&#039;);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and would need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.numeric-multi .answer li {&lt;br /&gt;
	border-bottom: 5px solid #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li label {&lt;br /&gt;
	background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.numeric-multi .answer li div.multinum-slider {&lt;br /&gt;
	margin: 1.5em 0.5em 0.2em 0;&lt;br /&gt;
	padding-left: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.ui-slider-1 {&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.changedSlider {&lt;br /&gt;
	background-color: #99FFFF;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Dynamic Slider Call-Out Styles=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 9-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is an example of how to insert a custom &#039;&#039;&#039;&#039;&#039;slide()&#039;&#039;&#039;&#039;&#039; function to control the appearance of the slider call-out as the slider is manipulated. In this example the call-out text colour changes as the slider is moved. Sample survey here - [[Media:Dynamic_slider_call_out.lss|dynamic call-out slider survey]].&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Dynamic_slider_call_out.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
 &lt;br /&gt;
		// Slide function&lt;br /&gt;
		$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function( event, ui ) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), ui.value);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Initial callout states&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			handleCallout($(this).closest(&#039;li.answer-item&#039;), $(this).val());&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Handle the callout style&lt;br /&gt;
		function handleCallout(thisRow, sliderVal) {&lt;br /&gt;
			if(sliderVal &amp;lt; 20) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D90000&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 40) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D96D00&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else if(sliderVal &amp;lt; 60) {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#D9D900&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.slider_callout&#039;, thisRow).css(&#039;color&#039;, &#039;#00B22D&#039;);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sliders in Array-Numbers or Array-Dual-Scale-Numbers=&lt;br /&gt;
&lt;br /&gt;
This workaround will replace the dropdowns in &#039;&#039;&#039;&#039;&#039;array-numbers&#039;&#039;&#039;&#039;&#039; or &#039;&#039;&#039;&#039;&#039;array-dual-scale-numbers&#039;&#039;&#039;&#039;&#039; questions with sliders. The sliders will automatically have the same minimum, maximum and steps that you set in the advanced question settings.&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.06==&lt;br /&gt;
[[File:custom_sliders_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; select&#039;).each(function(i, el){&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				var id = $(el).attr(&#039;id&#039;).replace(/#/g,&#039;-&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = Number($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).val());&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).next(&#039;option&#039;).val());&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Insert a container for the slider&lt;br /&gt;
				var container = $(&#039;&amp;lt;div class=&amp;quot;customSliderWrapper&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				var slider = $(&#039;&amp;lt;div id=&amp;quot;slider-&#039;+id+&#039;&amp;quot; class=&amp;quot;customSlider&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo(container).slider({&lt;br /&gt;
					min: firstVal,&lt;br /&gt;
					max: lastVal,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					value: currentVal,&lt;br /&gt;
					step: secondVal - firstVal,&lt;br /&gt;
					slide: function( event, ui ) {&lt;br /&gt;
						$(el).val(ui.value);&lt;br /&gt;
						$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
&lt;br /&gt;
				// Insert a callout&lt;br /&gt;
				var callout = $(&#039;&amp;lt;div id=&amp;quot;callOut-&#039;+id+&#039;&amp;quot; class=&amp;quot;slider_callout slider-callout&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#039;).appendTo($(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;)).text($(&#039;option:selected&#039;, el).val());&lt;br /&gt;
&lt;br /&gt;
				// Set a value as soon as the slider handle is clicked&lt;br /&gt;
				$(&#039;#slider-&#039;+id+&#039; .ui-slider-handle&#039;).mousedown(function() {&lt;br /&gt;
					$(el).val(slider.slider(&#039;value&#039;));&lt;br /&gt;
					$(&#039;#callOut-&#039;+id).text($(el).val());&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.customSliderWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 10px;&lt;br /&gt;
	padding-top: 1.75em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey Version 2.6x==&lt;br /&gt;
[[File:Dropdown-sliders.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.64.7 &#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your array-numbers or array-dual-scale-numbers question.&lt;br /&gt;
#Add the following to the source of the question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		insertSlider ({QID});&lt;br /&gt;
&lt;br /&gt;
		function insertSlider (qID) {&lt;br /&gt;
			&lt;br /&gt;
			// Identify this question&lt;br /&gt;
			var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
			thisQuestion.addClass(&#039;with-dropdown-sliders&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through all array drop-downs&lt;br /&gt;
			$(&#039;select.multiflexiselect&#039;, thisQuestion).each(function(i, el){&lt;br /&gt;
				var thisCell = $(el).closest(&#039;td&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Hide the dropdown&lt;br /&gt;
				$(el).hide();&lt;br /&gt;
&lt;br /&gt;
				// Some dropdown values&lt;br /&gt;
				var currentVal = $(el).val();&lt;br /&gt;
				var firstVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:first&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var secondVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:eq(1)&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
				var lastVal = Number($(&#039;option[value!=&amp;quot;&amp;quot;]:last&#039;, el).attr(&#039;value&#039;));&lt;br /&gt;
&lt;br /&gt;
				// Insert an input for the slider&lt;br /&gt;
				var thisInput = $(&#039;&amp;lt;input class=&amp;quot;inserted-input&amp;quot; type=&amp;quot;text&amp;quot; /&amp;gt;&#039;).insertAfter(el);&lt;br /&gt;
				&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				thisInput.val(currentVal).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: firstVal,&lt;br /&gt;
					&#039;max&#039;: lastVal,&lt;br /&gt;
					&#039;step&#039;: secondVal - firstVal,&lt;br /&gt;
					&#039;value&#039;: Number(currentVal),&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Listener on the slider&lt;br /&gt;
				$(thisInput).on(&#039;slideStop&#039;, function () {&lt;br /&gt;
					if($(&#039;.tooltip&#039;, thisCell).is(&#039;:hidden&#039;)) {&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).show();&lt;br /&gt;
						$(&#039;.tooltip&#039;, thisCell).css(&#039;margin-left&#039;, &#039;-&#039;+($(&#039;.tooltip&#039;, thisCell).width()/2)+&#039;px&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(el).val($(thisInput).val());&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				// Hide the slider call-out if no value selected yet&lt;br /&gt;
				if(currentVal == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.tooltip&#039;, thisCell).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add something like the following to the end of &#039;&#039;&#039;template.css&#039;&#039;&#039; (these styles are for the default template and may need to be modified for other templates):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal {&lt;br /&gt;
    margin: 1.5em auto  1em auto;&lt;br /&gt;
    width: 90%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.with-dropdown-sliders .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey for version 2.6x: [[Media:Demo_Sliders_in_Array_Survey.zip|Demo_Sliders_in_Array_Survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Vertical Sliders=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, 2.00+, IE 9, Firefox 13, Chrome 19&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to apply vertical sliders to multiple-numeric questions. You can download a sample template here (with the plugin in template.js) - [[Media:default_vertical_sliders.zip|vertical slider template]] - and a sample survey here - [[Media:demo_vertical_sliders.lss|vertical slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:verticalsliders_1.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question(s). Do NOT use any of the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js. Replace &amp;quot;QQ&amp;quot; (line 5) with the question ID and adjust the options in the function call as desired. Repeat the call as many times as you need for more questions&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
	// Call the vertical slider plugin with the question ID&lt;br /&gt;
	// Edit options here as desired&lt;br /&gt;
	$(&#039;#questionQQ&#039;).lsVerticalSlider({&lt;br /&gt;
		minValue		:0,		// Minimum value (default 0)&lt;br /&gt;
		maxValue		:200,	// Maximum value (default 100)&lt;br /&gt;
		startValue		:100,	// Start value (default null)&lt;br /&gt;
		step			:10,	// Slider increments (default 1)&lt;br /&gt;
		height			:100,	// Height of slider in pixels (default 200)&lt;br /&gt;
		recordStart		:true,	// Record the start value? (default no)&lt;br /&gt;
		showMin			:true,	// Show minimum value? (default no)&lt;br /&gt;
		showMax			:true	// Show maximum value? (default no)&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
// NO EDITING REQUIRED BELOW HERE&lt;br /&gt;
// A jQuery plugin to convert multiple-numeric questions to vertical sliders&lt;br /&gt;
(function( $ ){&lt;br /&gt;
	$.fn.lsVerticalSlider = function(options) {&lt;br /&gt;
&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			minValue		:0,&lt;br /&gt;
			maxValue		:100,&lt;br /&gt;
			startValue		:&#039;&#039;,&lt;br /&gt;
			step			:1,&lt;br /&gt;
			height			:150,&lt;br /&gt;
			recordStart		:false,&lt;br /&gt;
			showMin			:false,&lt;br /&gt;
			showMax			:false&lt;br /&gt;
		}, options);&lt;br /&gt;
&lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
&lt;br /&gt;
			var $this = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Some classes for the question and subquestions&lt;br /&gt;
			$this.addClass(&#039;vertical-slider-question&#039;);&lt;br /&gt;
			$(&#039;li:[id&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).addClass(&#039;vertical-slider-subquestion&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Loop through the subquestions&lt;br /&gt;
			$(&#039;li:[id&amp;lt;/div&amp;gt;=&amp;quot;javatbd&amp;quot;]&#039;, $this).each(function(i){&lt;br /&gt;
				var itemID = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) {&lt;br /&gt;
					opts.startValue = $(&#039;#answer&#039;+itemID).val();&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Insert the slider elements&lt;br /&gt;
				$(&#039;#answer&#039;+itemID).after(&lt;br /&gt;
					&#039;&amp;lt;div class=&amp;quot;vertical-slider-max-min&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-max&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-min&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div id=&amp;quot;vertical-slider-&#039;+itemID+&#039;&amp;quot; class=&amp;quot;vertical-slider&amp;quot; style=&amp;quot;height:&#039;+opts.height+&#039;px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;div class=&amp;quot;vertical-slider-callout-wrapper&amp;quot; style=&amp;quot;height:&#039;+(opts.height+2)+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;vertical-slider-callout&amp;quot; id=&amp;quot;slider-callout-&#039;+itemID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt;&#039;&lt;br /&gt;
				);&lt;br /&gt;
&lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.vertical-slider-max&#039;, $this).text(opts.maxValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.vertical-slider-min&#039;, $this).text(opts.minValue);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				$(&#039;#vertical-slider-&#039;+itemID).slider({&lt;br /&gt;
					orientation: &#039;vertical&#039;,&lt;br /&gt;
					range: &#039;min&#039;,&lt;br /&gt;
					min: opts.minValue,&lt;br /&gt;
					max: opts.maxValue,&lt;br /&gt;
					value: opts.startValue,&lt;br /&gt;
					step: opts.step,&lt;br /&gt;
					slide: function(event, ui) {&lt;br /&gt;
						$(&#039;#answer&#039;+itemID).val(ui.value);&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).text(ui.value);&lt;br /&gt;
						setTimeout(function() {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) }).show();&lt;br /&gt;
						}, 10);&lt;br /&gt;
					},&lt;br /&gt;
					create: function(event, ui) {&lt;br /&gt;
						// Initial values and positions&lt;br /&gt;
						if($(&#039;#answer&#039;+itemID).val() != &#039;&#039;) { // Pre-existing answer&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else if(opts.recordStart) { // Record the start value (if option is set)&lt;br /&gt;
							$(&#039;#answer&#039;+itemID).val(opts.startValue);&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).text(opts.startValue);&lt;br /&gt;
						}&lt;br /&gt;
						else {&lt;br /&gt;
							$(&#039;#slider-callout-&#039;+itemID).hide();&lt;br /&gt;
						}&lt;br /&gt;
						$(&#039;#slider-callout-&#039;+itemID).css({ &#039;bottom&#039;:$(&#039;#vertical-slider-&#039;+itemID+&#039; .ui-slider-handle&#039;).css(&#039;bottom&#039;) });&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Vertical slider styles and overrides */&lt;br /&gt;
.vertical-slider-question p.tip {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-subquestion {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 0 3em 0 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question label {&lt;br /&gt;
	display: block;&lt;br /&gt;
	padding: 0 0 0.75em 0 !important;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question span.input {&lt;br /&gt;
	padding: 0.3em 0 0 0;&lt;br /&gt;
	display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question input.text {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider {&lt;br /&gt;
	float: left;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-question .ui-slider-handle {&lt;br /&gt;
	top: auto;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min,&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	position: relative;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout-wrapper {&lt;br /&gt;
	min-width: 3em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max-min {&lt;br /&gt;
	margin-right: 0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max,&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	font-size: 0.8em;&lt;br /&gt;
	color:#666666;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-max {&lt;br /&gt;
	margin-top: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-min {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	right: 0;&lt;br /&gt;
	bottom: 0;&lt;br /&gt;
	margin-bottom: -0.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vertical-slider-callout {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	top: auto;&lt;br /&gt;
	margin: 0 0 -0.6em 0.5em;&lt;br /&gt;
	padding: 0.1em;&lt;br /&gt;
	font-size: 0.9em;&lt;br /&gt;
	color:#000000;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	background: #F8F8FF;&lt;br /&gt;
	border: 1px solid #D2E0F2;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Range Slider=&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.06==&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert a jQuery UI range slider into a multi-numeric question and automatically populate that question&#039;s inputs with the range min and max values. You can download a sample template here - [[Media:Demo_Range_Slider.zip|range slider template]] - and a sample survey here - [[Media:Limesurvey_survey_range_slider.lss|range slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:Range_slider.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin handles:&lt;br /&gt;
*previous answers&lt;br /&gt;
*slider max/min&lt;br /&gt;
*range min start&lt;br /&gt;
*range max start&lt;br /&gt;
*range span min&lt;br /&gt;
*slider step&lt;br /&gt;
*slider width&lt;br /&gt;
*record the start values&lt;br /&gt;
*show slider max and min&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 1.92 or newer&lt;br /&gt;
*A multiple-numeric question with two subquestions&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question. Do NOT use any of the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A jQuery plugin to display a range slider in LimeSurvey&lt;br /&gt;
(function( $ ){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.lsRangeSlider = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			range			:true, &lt;br /&gt;
			sliderMin		:0, &lt;br /&gt;
			sliderMax		:100,&lt;br /&gt;
			rangeStartMin		:&#039;&#039;,&lt;br /&gt;
			rangeStartMax		:&#039;&#039;,&lt;br /&gt;
			minRangeSpan		:0,&lt;br /&gt;
			step			:1,&lt;br /&gt;
			width			:250, &lt;br /&gt;
			recordStart		:false,&lt;br /&gt;
			showMin			:false,&lt;br /&gt;
			showMax			:false&lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
 &lt;br /&gt;
			if($(this).hasClass(&#039;numeric-multi&#039;) &amp;amp;&amp;amp; $(&#039;input.text&#039;, this).length == 2) {&lt;br /&gt;
 &lt;br /&gt;
				// Define some vars	&lt;br /&gt;
				var $this = $(this);&lt;br /&gt;
				var qID = $(this).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
				var rangeMinInput = $(&#039;input.text:eq(0)&#039;, $this); &lt;br /&gt;
				var rangeMaxInput = $(&#039;input.text:eq(1)&#039;, $this); &lt;br /&gt;
 &lt;br /&gt;
				// Some classes for the question and subquestions&lt;br /&gt;
				$this.addClass(&#039;range-slider-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() != &#039;&#039;) {&lt;br /&gt;
					opts.rangeStartMin = $(rangeMinInput).val();&lt;br /&gt;
					opts.rangeStartMax = $(rangeMaxInput).val();&lt;br /&gt;
				}&lt;br /&gt;
 &lt;br /&gt;
				// Insert the slider elements&lt;br /&gt;
				$(&#039;.subquestions-list&#039;, $this).before(&lt;br /&gt;
					&#039;&amp;lt;div class=&amp;quot;range-slider-wrapper&amp;quot;&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;range-slider-min&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div id=&amp;quot;range-slider-&#039;+qID+&#039;&amp;quot; class=&amp;quot;range-slider&amp;quot; style=&amp;quot;width:&#039;+opts.width+&#039;px;&amp;quot;&amp;gt; \&lt;br /&gt;
							&amp;lt;div class=&amp;quot;range-slider-callout&amp;quot; id=&amp;quot;slider-callout-min-&#039;+qID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
							&amp;lt;div class=&amp;quot;range-slider-callout&amp;quot; id=&amp;quot;slider-callout-max-&#039;+qID+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div class=&amp;quot;range-slider-max&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
						&amp;lt;div style=&amp;quot;clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; \&lt;br /&gt;
					&amp;lt;/div&amp;gt;&#039;&lt;br /&gt;
				);&lt;br /&gt;
 &lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.range-slider-max&#039;, $this).text(opts.sliderMax);&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.range-slider-min&#039;, $this).text(opts.sliderMin);&lt;br /&gt;
				}&lt;br /&gt;
 &lt;br /&gt;
				// Initiate the slider&lt;br /&gt;
				var rangeMin;&lt;br /&gt;
				var rangeMax;&lt;br /&gt;
				if(opts.rangeStartMin == &#039;&#039; || opts.rangeStartMin &amp;lt; opts.sliderMin || opts.rangeStartMin &amp;gt; opts.rangeStartMax) {&lt;br /&gt;
					rangeMin = opts.sliderMin+((opts.sliderMax-opts.sliderMin)*0.3333);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					rangeMin = opts.rangeStartMin;&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.rangeStartMax == &#039;&#039; || opts.rangeStartMax &amp;gt; opts.sliderMax || opts.rangeStartMax &amp;lt; opts.rangeStartMin) {&lt;br /&gt;
					rangeMax = opts.sliderMin+((opts.sliderMax-opts.sliderMin)*0.6667);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					rangeMax = opts.rangeStartMax;&lt;br /&gt;
				}&lt;br /&gt;
				$(&#039;#range-slider-&#039;+qID).slider({&lt;br /&gt;
					range: true,&lt;br /&gt;
					min: opts.sliderMin,&lt;br /&gt;
					max: opts.sliderMax, &lt;br /&gt;
					values: [ rangeMin, rangeMax ],&lt;br /&gt;
					step: opts.step,&lt;br /&gt;
					slide: function(event, ui) {&lt;br /&gt;
						if((ui.values[1] - ui.values[0]) &amp;lt; opts.minRangeSpan) {&lt;br /&gt;
							return false; // Nothing happens if less than minRangeSpan&lt;br /&gt;
						}&lt;br /&gt;
						$(rangeMinInput).val(ui.values[0]);&lt;br /&gt;
						$(rangeMaxInput).val(ui.values[1]);&lt;br /&gt;
						$(&#039;#slider-callout-min-&#039;+qID).text(ui.values[0]);&lt;br /&gt;
						$(&#039;#slider-callout-max-&#039;+qID).text(ui.values[1]);&lt;br /&gt;
						setTimeout(function() { &lt;br /&gt;
							$(&#039;#slider-callout-min-&#039;+qID).css({ &#039;left&#039;:$(&#039;.ui-slider-handle:eq(0)&#039;, $this).position().left - $(&#039;#slider-callout-min-&#039;+qID).outerWidth() - ($(&#039;.ui-slider-handle:eq(1)&#039;, $this).outerWidth()/2)+&#039;px&#039; }).show();&lt;br /&gt;
							$(&#039;#slider-callout-max-&#039;+qID).css({ &#039;left&#039;:($(&#039;.ui-slider-handle:eq(1)&#039;, $this).position().left)+($(&#039;.ui-slider-handle:eq(1)&#039;, $this).outerWidth()/2)+&#039;px&#039; }).show();&lt;br /&gt;
						}, 10);&lt;br /&gt;
					},&lt;br /&gt;
					create: function(event, ui) {&lt;br /&gt;
						// Initial values and positions&lt;br /&gt;
						if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMaxInput).val() != &#039;&#039;) { // Pre-existing answer&lt;br /&gt;
							$(&#039;#slider-callout-min-&#039;+qID).text(opts.rangeStartMin);&lt;br /&gt;
							$(&#039;#slider-callout-max-&#039;+qID).text(opts.rangeStartMax);&lt;br /&gt;
						}&lt;br /&gt;
						else if(opts.recordStart &amp;amp;&amp;amp; opts.rangeStartMin &amp;amp;&amp;amp; opts.rangeStartMin &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMaxInput).val() == &#039;&#039;) { // Record the start value (if option is set)&lt;br /&gt;
							$(rangeMinInput).val(opts.rangeStartMin);&lt;br /&gt;
							$(rangeMaxInput).val(opts.rangeStartMax);&lt;br /&gt;
							$(&#039;#slider-callout-min-&#039;+qID).text(opts.rangeStartMin);&lt;br /&gt;
							$(&#039;#slider-callout-max-&#039;+qID).text(opts.rangeStartMax);&lt;br /&gt;
						}&lt;br /&gt;
						else {&lt;br /&gt;
							$(&#039;.range-slider-callout&#039;, $this).hide();&lt;br /&gt;
						} &lt;br /&gt;
						$(&#039;#slider-callout-min-&#039;+qID).css({ &#039;left&#039;:$(&#039;.ui-slider-handle:eq(0)&#039;, $this).position().left - $(&#039;#slider-callout-min-&#039;+qID).outerWidth() - ($(&#039;.ui-slider-handle:eq(1)&#039;, $this).outerWidth()/2)+&#039;px&#039; });&lt;br /&gt;
						$(&#039;#slider-callout-max-&#039;+qID).css({ &#039;left&#039;:($(&#039;.ui-slider-handle:eq(1)&#039;, $this).position().left)+($(&#039;.ui-slider-handle:eq(1)&#039;, $this).outerWidth()/2)+&#039;px&#039; });&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template but easily modified for others):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.range-slider-question p.tip,&lt;br /&gt;
.range-slider-question .subquestions-list {&lt;br /&gt;
	display: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-wrapper {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	margin: 10px 0;&lt;br /&gt;
	padding-top: 20px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider,&lt;br /&gt;
.range-slider-max,&lt;br /&gt;
.range-slider-min {&lt;br /&gt;
	float: left;&lt;br /&gt;
	position: relative;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-max,&lt;br /&gt;
.range-slider-min {&lt;br /&gt;
	font-size: 0.8em;&lt;br /&gt;
	color:#666666;&lt;br /&gt;
	line-height: 1.20;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-min {&lt;br /&gt;
	margin-right: 5px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-max {&lt;br /&gt;
	margin-left: 5px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-question .ui-slider-handle {&lt;br /&gt;
	top: -4px;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.range-slider-callout {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	top: -30px;&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	min-width: 1.3em;&lt;br /&gt;
	padding: 0.1em;&lt;br /&gt;
	font-size: 0.9em;&lt;br /&gt;
	color:#000000;&lt;br /&gt;
	line-height: 1;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	background: #F8F8FF;&lt;br /&gt;
	border: 1px solid #D2E0F2;&lt;br /&gt;
	border-radius: 4px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider({&lt;br /&gt;
			sliderMin	:0,	// Minimum slider value (default 0)&lt;br /&gt;
			sliderMax	:100,	// Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:20,	// Minimum range handle start value  &lt;br /&gt;
			rangeStartMax	:80,	// Maximum range handle start value  &lt;br /&gt;
			minRangeSpan	:5,	// Minimum allowed range span &lt;br /&gt;
			step		:1,	// Slider increments (default 1)&lt;br /&gt;
			width		:400,	// Width of slider in pixels (default 250)&lt;br /&gt;
			recordStart	:true,	// Record the start value? (default no)&lt;br /&gt;
			showMin		:true,	// Show slider minimum value? (default no)&lt;br /&gt;
			showMax		:true	// Show slider maximum value? (default no)&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Or, to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider();&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert a jQuery UI range slider into a multi-numeric question and automatically populate that question&#039;s inputs with the range min and max values.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039;: [[Media:Demo_Range_Slider_2.5x.zip|Sample Template and Survey.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_Range_Slider_2.5x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin handles:&lt;br /&gt;
*previous answers&lt;br /&gt;
*slider max/min&lt;br /&gt;
*range min start&lt;br /&gt;
*range max start&lt;br /&gt;
*range span min&lt;br /&gt;
*slider step&lt;br /&gt;
*record the start values&lt;br /&gt;
*show slider max and min&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;LimeSurvey 2.5x&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A multiple-numeric question with two subquestions&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Create your multi-numeric question. Do NOT use any of the slider advanced settings.&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A jQuery plugin to display a range slider in LimeSurvey&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.lsRangeSlider = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:100, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:&#039;&#039;, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:&#039;&#039;, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:false, // Record the start value? (default no)&lt;br /&gt;
			showMin			:false, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:false // Show slider maximum value? (default no)&lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
 &lt;br /&gt;
			if($(this).hasClass(&#039;numeric-multi&#039;) &amp;amp;&amp;amp; $(&#039;input.text&#039;, this).length == 2) {&lt;br /&gt;
 &lt;br /&gt;
				// Define some vars	&lt;br /&gt;
				var thisQuestion = $(this);&lt;br /&gt;
				var rangeMinInput = $(&#039;input.text.form-control:eq(0)&#039;, thisQuestion); &lt;br /&gt;
				var rangeMaxInput = $(&#039;input.text.form-control:eq(1)&#039;, thisQuestion); &lt;br /&gt;
				thisQuestion.addClass(&#039;range-slider-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
				// Check for pre-existing answer&lt;br /&gt;
				if($(rangeMinInput).val() != &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() != &#039;&#039;) {&lt;br /&gt;
					opts.rangeStartMin = $(rangeMinInput).val();&lt;br /&gt;
					opts.rangeStartMax = $(rangeMaxInput).val();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					if(opts.rangeStartMin == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMin = opts.sliderMin;&lt;br /&gt;
					}&lt;br /&gt;
					if(opts.rangeStartMax == &#039;&#039;) {&lt;br /&gt;
						opts.rangeStartMax = opts.sliderMax;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
		&lt;br /&gt;
				// Insert the slider&lt;br /&gt;
				var insertedEls = &#039;&amp;lt;div class=&amp;quot;col-xs-12 col-sm-12 withslider&amp;quot;&amp;gt;\&lt;br /&gt;
										&amp;lt;input class=&amp;quot;inserted-slider&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;rangeSlider&amp;quot; /&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-left&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-min&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
										&amp;lt;div class=&amp;quot;pull-right&amp;quot;&amp;gt;\&lt;br /&gt;
											&amp;lt;span class=&amp;quot;help-block inserted-slider-max&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;\&lt;br /&gt;
										&amp;lt;/div&amp;gt;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;].form-control:eq(0)&#039;, thisQuestion).closest(&#039;.subquestion-list&#039;).hide().before(insertedEls);&lt;br /&gt;
				&lt;br /&gt;
				var sliderValues = [Number(opts.rangeStartMin), Number(opts.rangeStartMax)];&lt;br /&gt;
			&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider({&lt;br /&gt;
					&#039;min&#039;: Number(opts.sliderMin),&lt;br /&gt;
					&#039;max&#039;: Number(opts.sliderMax),&lt;br /&gt;
					&#039;step&#039;: Number(opts.step),&lt;br /&gt;
					&#039;range&#039;: true,&lt;br /&gt;
					&#039;value&#039;: sliderValues,&lt;br /&gt;
					&#039;tooltip&#039;: &#039;always&#039;&lt;br /&gt;
				});&lt;br /&gt;
				if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider .tooltip&#039;, thisQuestion).hide();&lt;br /&gt;
				}&lt;br /&gt;
						&lt;br /&gt;
				// Listener on the range slider&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slideStart&#039;, function(event, ui) {&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;input.inserted-slider&#039;, thisQuestion).on(&#039;slide slideStop&#039;, function(event, ui) {&lt;br /&gt;
					var thisLowerVal = Number($.trim($(this).val().split(&#039;,&#039;)[0]));&lt;br /&gt;
					var thisUpperVal = Number($.trim($(this).val().split(&#039;,&#039;)[1]));&lt;br /&gt;
					if(opts.minRangeSpan &amp;gt; 0 &amp;amp;&amp;amp; (thisUpperVal-thisLowerVal) &amp;lt; opts.minRangeSpan) {&lt;br /&gt;
						$(&#039;input.inserted-slider&#039;, thisQuestion).bootstrapSlider(&#039;setValue&#039;, sliderValues);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(thisLowerVal);&lt;br /&gt;
						$(rangeMaxInput).val(thisUpperVal);&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
						sliderValues = [thisLowerVal, thisUpperVal];&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
 &lt;br /&gt;
				// Show min/max if option is set&lt;br /&gt;
				if(opts.showMin) {&lt;br /&gt;
					$(&#039;.inserted-slider-min&#039;, thisQuestion).text(opts.sliderMin);&lt;br /&gt;
				}&lt;br /&gt;
				if(opts.showMax) {&lt;br /&gt;
					$(&#039;.inserted-slider-max&#039;, thisQuestion).text(opts.sliderMax);&lt;br /&gt;
				}&lt;br /&gt;
				&lt;br /&gt;
				// Handle recordStart&lt;br /&gt;
				if(opts.recordStart) {&lt;br /&gt;
					if($(rangeMinInput).val() == &#039;&#039; &amp;amp;&amp;amp; $(rangeMinInput).val() == &#039;&#039;) {&lt;br /&gt;
						// Load the LS inputs&lt;br /&gt;
						$(rangeMinInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[0])));&lt;br /&gt;
						$(rangeMaxInput).val(Number($.trim($(&#039;input.inserted-slider&#039;, thisQuestion).val().split(&#039;,&#039;)[1])));&lt;br /&gt;
						// Fire Expression manager&lt;br /&gt;
						checkconditions($(rangeMinInput).attr(&#039;value&#039;), $(rangeMinInput).attr(&#039;name&#039;), $(rangeMinInput).attr(&#039;type&#039;));&lt;br /&gt;
						checkconditions($(rangeMaxInput).attr(&#039;value&#039;), $(rangeMaxInput).attr(&#039;name&#039;), $(rangeMaxInput).attr(&#039;type&#039;));&lt;br /&gt;
						// Show the tooltip&lt;br /&gt;
						$(&#039;.slider .tooltip&#039;, thisQuestion).show();&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider({&lt;br /&gt;
			sliderMin		:0, // Minimum slider value (default 0)&lt;br /&gt;
			sliderMax		:10, // Maximum slider value (default 100) &lt;br /&gt;
			rangeStartMin	:2, // Minimum range handle start value (default sliderMin)&lt;br /&gt;
			rangeStartMax	:8, // Maximum range handle start value (default sliderMax)&lt;br /&gt;
			minRangeSpan	:0, // Minimum allowed range span (default 0)&lt;br /&gt;
			step			:1, // Slider increments (default 1)&lt;br /&gt;
			recordStart		:true, // Record the start value? (default no)&lt;br /&gt;
			showMin			:true, // Show slider minimum value? (default no)&lt;br /&gt;
			showMax			:true // Show slider maximum value? (default no)&lt;br /&gt;
		});&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Or, to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){	&lt;br /&gt;
	&lt;br /&gt;
		$(&#039;#question{QID}&#039;).lsRangeSlider();&lt;br /&gt;
	}); &lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Reverse Slider=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 7-10, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is an example of how to insert a custom &#039;&#039;&#039;&#039;&#039;slide()&#039;&#039;&#039;&#039;&#039; function to reverse the slider.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Reverse_slider.lss.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Caveats:&lt;br /&gt;
*Developed for LS 2.05&lt;br /&gt;
*The &amp;quot;Reset&amp;quot; button will not work&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function reverseSlider(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Identify the question&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
 &lt;br /&gt;
	//$(&#039;span.input&#039;, thisQuestion).show() // un-comment this to debug&lt;br /&gt;
 &lt;br /&gt;
	// Reverse the min/max displays&lt;br /&gt;
	$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var showMinText = $(&#039;.slider-showmin&#039;, this).text();&lt;br /&gt;
		var showMaxText = $(&#039;.slider-showmax&#039;, this).text();&lt;br /&gt;
		$(&#039;.slider-showmin&#039;, this).text(showMaxText);&lt;br /&gt;
		$(&#039;.slider-showmax&#039;, this).text(showMinText);&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial slider positions&lt;br /&gt;
	$(&#039;span.input input[type=&amp;quot;text&amp;quot;]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
 &lt;br /&gt;
		if($(this).val() != &#039;&#039;) {				&lt;br /&gt;
			var thisRow = $(this).closest(&#039;li.answer-item&#039;);				&lt;br /&gt;
			var thisSlider = $(&#039;.ui-slider&#039;, thisRow);&lt;br /&gt;
			var sliderValue = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;)+$(thisSlider).slider(&#039;option&#039;, &#039;min&#039;)-$(this).val();&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisRow).slider(&#039;option&#039;, &#039;value&#039;, sliderValue);&lt;br /&gt;
			$(&#039;.slider-callout&#039;, thisRow).text($(this).val()); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// New slide function&lt;br /&gt;
	$(&#039;.ui-slider&#039;, thisQuestion).slider( &#039;option&#039;, &#039;slide&#039;, function(event, ui) {		&lt;br /&gt;
		// Define a few vars&lt;br /&gt;
		var thisRow = $(this).closest(&#039;li.answer-item&#039;);&lt;br /&gt;
		var thisSlider = $(this);&lt;br /&gt;
		var step = $(thisSlider).slider(&#039;option&#039;, &#039;step&#039;).toString();&lt;br /&gt;
		var stepDecimals = &#039;&#039;;&lt;br /&gt;
		if(step.indexOf(&#039;.&#039;) != -1) {&lt;br /&gt;
			stepDecimals = step.length - (step.indexOf(&#039;.&#039;)+1);&lt;br /&gt;
		}&lt;br /&gt;
		var reverseValue = &#039;&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Calculate the &amp;quot;reverse&amp;quot; value&lt;br /&gt;
		if(ui.value &amp;gt; $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;)) {&lt;br /&gt;
			reverseValue = $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else if(ui.value &amp;lt; $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;)) {&lt;br /&gt;
			reverseValue = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else if(stepDecimals &amp;gt; 0) { // Handle decimal places&lt;br /&gt;
			reverseValue = ($(thisSlider).slider(&#039;option&#039;, &#039;max&#039;)+$(thisSlider).slider(&#039;option&#039;, &#039;min&#039;)-ui.value).toFixed(stepDecimals);&lt;br /&gt;
		}&lt;br /&gt;
		else{&lt;br /&gt;
			reverseValue = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;)+$(thisSlider).slider(&#039;option&#039;, &#039;min&#039;)-ui.value;&lt;br /&gt;
		}&lt;br /&gt;
		reverseValue = reverseValue.toString();&lt;br /&gt;
		reverseValue = reverseValue.replace(/\./,LSvar.sLEMradix);&lt;br /&gt;
 &lt;br /&gt;
		// Load the callout&lt;br /&gt;
		$(&#039;.slider_callout&#039;, thisRow).text(reverseValue);&lt;br /&gt;
 &lt;br /&gt;
		// Set the data value&lt;br /&gt;
		$(&#039;input.text&#039;, thisRow).val(reverseValue);&lt;br /&gt;
		$(&#039;input.text&#039;, thisRow).triggerHandler(&amp;quot;keyup&amp;quot;);&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add this script to the source of every question you want to &amp;quot;reverse&amp;quot;:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
    $(document).ready(function() { 	&lt;br /&gt;
		reverseSlider({QID});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sliders With Control Buttons=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 7-10, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses a custom jQuery plugin to insert &amp;quot;up&amp;quot; and &amp;quot;down&amp;quot; buttons to control sliders. You can download a sample template here - [[Media:Demo_Slider_Buttons.zip|slider with buttons template]] - and a sample survey here - [[Media:Limesurvey_survey_button_slider.lss|button slider survey]].&lt;br /&gt;
&lt;br /&gt;
[[File:Button_slider.jpg]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The plugin allows the following options:&lt;br /&gt;
*Down Text: Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
*Up Text: Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
*Scrolling: Continuous slider movement if the left mouse button is held down&lt;br /&gt;
*Scroll Interval: Interval (in milliseconds) between slider movement when button is held down (do not make this too short or it will be difficult to stop the slider accurately)&lt;br /&gt;
*Value Prefix: Prefix for call-out&lt;br /&gt;
*Value Suffix: Suffix for call-out&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
*LimeSurvey 2.05 or newer&lt;br /&gt;
*A multiple-numeric question with slider enabled&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# Create your multi-numeric question with the slider advanced settings.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.js.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A custom plugin to add control buttons to LimeSurvey sliders&lt;br /&gt;
// Author - Tony Partner - partnersurveys.com&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.sliderButtons = function(options) {&lt;br /&gt;
	&lt;br /&gt;
		// The defaults, extended and modified with any passed in the function call&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
		downText: &#039;-&#039;,		// Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
		upText: &#039;+&#039;,		// Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
		scrolling: true,	// Continuous slider movement if left mouse button held down&lt;br /&gt;
		scrollInterval: 150,// Interval (in ms) between slider movement when button is held down&lt;br /&gt;
		valuePrefix: &#039;&#039;,	// Prefix for callout&lt;br /&gt;
		valueSuffix: &#039;&#039;	// Suffix for callout&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function(i) {&lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
	&lt;br /&gt;
			// Add some classes&lt;br /&gt;
			$(thisQuestion).addClass(&#039;slider-button-question&#039;);		&lt;br /&gt;
			&lt;br /&gt;
			// Insert the buttons&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;slider-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button down&amp;quot;&amp;gt;&#039;+opts.downText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
															&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;slider-button up&amp;quot;&amp;gt;&#039;+opts.upText+&#039;&amp;lt;/button&amp;gt;\&lt;br /&gt;
														&amp;lt;/div&amp;gt;&#039;);			&lt;br /&gt;
			&lt;br /&gt;
			// Initial button states&lt;br /&gt;
			function handleButtonState(slider) {&lt;br /&gt;
				var thisRow = $(slider).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSliderVal = $(slider).slider(&#039;option&#039;, &#039;value&#039;);&lt;br /&gt;
				var thisSliderStep = $(slider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var thisSliderMin = $(slider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(slider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisRow).prop(&#039;disabled&#039;, false);&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMin) {&lt;br /&gt;
					$(&#039;button.slider-button.down&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
				if ($(slider).slider(&#039;option&#039;, &#039;value&#039;) == thisSliderMax) {&lt;br /&gt;
					$(&#039;button.slider-button.up&#039;, thisRow).prop(&#039;disabled&#039;, true);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				handleButtonState(this);	&lt;br /&gt;
				if($(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val() != &#039;&#039;) {&lt;br /&gt;
					$(&#039;.slider-callout&#039;, this).text(opts.valuePrefix+$(this).closest(&#039;li.question-item&#039;).find(&#039;input.text&#039;).val()+opts.valueSuffix);&lt;br /&gt;
				}&lt;br /&gt;
			});	&lt;br /&gt;
			&lt;br /&gt;
			// Function to handle button actions&lt;br /&gt;
			function handleButtons(thisButton) {&lt;br /&gt;
				var thisRow = $(thisButton).closest(&#039;li.question-item&#039;);&lt;br /&gt;
				var thisSlider = $(&#039;.multinum-slider&#039;, thisRow);&lt;br /&gt;
				var thisSliderStep = $(thisSlider).slider(&#039;option&#039;, &#039;step&#039;);&lt;br /&gt;
				var stepDecimals = 0;&lt;br /&gt;
				if(thisSliderStep.toString().indexOf(&#039;.&#039;) &amp;gt;= 0) {&lt;br /&gt;
					stepDecimals = thisSliderStep.toString().split(&#039;.&#039;)[1].length;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSliderVal = Number($(thisSlider).slider(&#039;option&#039;, &#039;value&#039;)).toFixed(stepDecimals);&lt;br /&gt;
				var thisSliderMin = $(thisSlider).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				var thisSliderMax = $(thisSlider).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;down&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;gt; thisSliderMin) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)-Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				if ($(thisButton).hasClass(&#039;up&#039;) &amp;amp;&amp;amp; thisSliderVal &amp;lt; thisSliderMax) {&lt;br /&gt;
					$(thisSlider).slider(&#039;option&#039;, &#039;value&#039;, Number(thisSliderVal)+Number(thisSliderStep));&lt;br /&gt;
				}&lt;br /&gt;
				var newValue = $(thisSlider).slider(&#039;option&#039;, &#039;value&#039;).toFixed(stepDecimals).replace(/\./, LSvar.sLEMradix);&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(newValue).triggerHandler(&#039;keyup&#039;);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisSlider).text(opts.valuePrefix+newValue+opts.valueSuffix);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Scrolling&lt;br /&gt;
			if(opts.scrolling == true) {&lt;br /&gt;
					&lt;br /&gt;
				var sliderTimeout;&lt;br /&gt;
				var clicker = $(&#039;button.slider-button&#039;, thisQuestion);&lt;br /&gt;
				var count = 0;&lt;br /&gt;
&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mousedown(function(){&lt;br /&gt;
					var thisButton = $(this);&lt;br /&gt;
					sliderTimeout = setInterval(function(){&lt;br /&gt;
						handleButtons(thisButton);&lt;br /&gt;
					}, opts.scrollInterval);				&lt;br /&gt;
					return false;&lt;br /&gt;
				});				&lt;br /&gt;
				&lt;br /&gt;
				$(document).mouseup(function(){&lt;br /&gt;
					clearInterval(sliderTimeout);&lt;br /&gt;
					return false;&lt;br /&gt;
				});&lt;br /&gt;
				$(&#039;button.slider-button&#039;, thisQuestion).mouseout(function(){&lt;br /&gt;
					handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Listener on the buttons&lt;br /&gt;
			$(&#039;button.slider-button&#039;, thisQuestion).click(function(e) {&lt;br /&gt;
				handleButtons(this)	;		&lt;br /&gt;
				handleButtonState($(this).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on sliders&lt;br /&gt;
			$(&#039;.multinum-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function( event, ui ) {&lt;br /&gt;
				handleButtonState(this);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Listener on reset buttons&lt;br /&gt;
			$(&#039;.slider-reset&#039;, thisQuestion).on( &amp;quot;click&amp;quot;, function( event, ui ) {&lt;br /&gt;
				var thisReset = $(this);&lt;br /&gt;
				setTimeout(function() {&lt;br /&gt;
					handleButtonState($(thisReset).closest(&#039;li.question-item&#039;).find(&#039;.multinum-slider&#039;));&lt;br /&gt;
				}, 150);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (these styles are for the default template but easily modified for others):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.slider-button-question label.slider-label {&lt;br /&gt;
    margin-top: 0;&lt;br /&gt;
    padding: 40px 1em 0 0;&lt;br /&gt;
    *padding: 25px 1em 0 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question div.multinum-slider {&lt;br /&gt;
	margin-top: 45px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .ui-slider-horizontal .ui-slider-handle {&lt;br /&gt;
	width: 18px;&lt;br /&gt;
    margin-left: -9px;&lt;br /&gt;
    top: -4px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider_callout {&lt;br /&gt;
    margin-left: -41px;&lt;br /&gt;
    text-align: center;&lt;br /&gt;
    width: 100px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 40px 0 0 25px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button {&lt;br /&gt;
	padding: 0 10px;&lt;br /&gt;
	margin: 0 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-button-wrapper button:disabled {&lt;br /&gt;
	opacity:0.65;&lt;br /&gt;
	filter:alpha(opacity=65);&lt;br /&gt;
	cursor: default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.slider-button-question .slider-reset {&lt;br /&gt;
	margin-top: 42px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Then, add something like this to the source of your question to apply the plugin with some custom option settings (I think the comments explain the options adequately)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons({&lt;br /&gt;
			downText: &#039;Down&#039;, // Text for the &amp;quot;down&amp;quot; button&lt;br /&gt;
			upText: &#039;Up&#039;, // Text for the &amp;quot;up&amp;quot; button&lt;br /&gt;
			scrolling: true, // Continuous slider movement if left mouse button held down&lt;br /&gt;
			scrollInterval: 250, // Interval (in ms) between slider movement when button is held down&lt;br /&gt;
			valueSuffix: &amp;quot;%&amp;quot;	// Suffix for callout&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#Or, simply to apply the plugin with the default option settings&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		$(&#039;#question{QID}&#039;).sliderButtons();&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Limit the language options dropdown on the list surveys page=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note: This feature is implemented in Version 2.0&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This solution allows you to define (in config.php) a comma-delimited list of languages you want in the dropdown.  It is not optimized (it loads all the languages and then unsets everything you don&#039;t want), but is fairly easy to implement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$supportedLanguagesKeys = &#039;en,vi&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Filter out everything except the your selected languages (if defined).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // if $supportedLanguagesKeys is defined in config, filter&lt;br /&gt;
&lt;br /&gt;
   if (!empty($GLOBALS[&#039;supportedLanguagesKeys&#039;]))&lt;br /&gt;
&lt;br /&gt;
   foreach (array_keys($supportedLanguages) as $lang) {&lt;br /&gt;
&lt;br /&gt;
     if (!in_array($lang, explode(&#039;,&#039;, $GLOBALS[&#039;supportedLanguagesKeys&#039;]))) {&lt;br /&gt;
&lt;br /&gt;
       unset($supportedLanguages[$lang]);&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now only my languages, plus the base language, is displayed. To get rid of the redundant base language, do the following&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
   } elseif (!isset($surveyid))&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       global $defaultlang, $baselang;&lt;br /&gt;
&lt;br /&gt;
       $htmlcode = &amp;quot;&amp;lt;select name=\&amp;quot;select\&amp;quot; class=&#039;languagechanger&#039; onchange=\&amp;quot;javascript:window.location=this.value\&amp;quot;&amp;gt;\n&amp;quot;;&lt;br /&gt;
#    REMOVE THE NEXT LINE OR COMMENT IT OUT)&lt;br /&gt;
&lt;br /&gt;
       $htmlcode .= &amp;quot;&amp;lt;option value=\&amp;quot;$relativeurl/index.php?lang=&amp;quot;. $defaultlang .&amp;quot;$tokenparam\&amp;quot;&amp;gt;&amp;quot;.getLanguageNameFromCode($defaultlang,false).&amp;quot;&amp;lt;/option&amp;gt;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   foreach(getlanguagedata() as $key=&amp;gt;$val)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           $htmlcode .= &amp;quot;\t&amp;lt;option value=\&amp;quot;$relativeurl/index.php?lang=&amp;quot;.$key.&amp;quot;$tokenparam\&amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
           if ($key == $baselang) $htmlcode .= &amp;quot; selected=&#039;selected&#039;&amp;quot;; /* ADD THIS TO SET SELECTION */&lt;br /&gt;
&lt;br /&gt;
           $htmlcode .= &amp;quot;&amp;gt;&amp;quot;.getLanguageNameFromCode($key,false).&amp;quot;&amp;lt;/option&amp;gt;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       $htmlcode .= &amp;quot;&amp;lt;/select&amp;gt;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Basically it just pre-selects the base language from the list.&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Question_type_-_Array_(10_point_choice)&amp;diff=125962</id>
		<title>Question type - Array (10 point choice)</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Question_type_-_Array_(10_point_choice)&amp;diff=125962"/>
		<updated>2018-09-26T11:46:49Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt; &amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Short description= &amp;lt;!--T:2--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:49--&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;/translate&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;{{#ifeq:{{{transcludesection|short_description}}}|short_description|&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;translate&amp;gt;&amp;lt;!--T:50--&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:23--&amp;gt;&lt;br /&gt;
It is an array question type that is prefilled with answer choices on a 1 to 10 scale. A &amp;quot;No answer&amp;quot; answer option is automatically added if the question is not mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:52--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] &#039;&#039;&#039;Hint:&#039;&#039;&#039; If you need to use another scale, change the question type to the general [[Question type - Array|array question type]]. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
[[File:B_10_point.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:51--&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Example:&#039;&#039;&#039; [[Media:Array 10 point choice example.zip|Array 10 point choice example.zip]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:53--&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;/translate&amp;gt;&amp;lt;/div&amp;gt;}}&amp;lt;/onlyinclude&amp;gt;&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;translate&amp;gt;&amp;lt;!--T:54--&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General settings= &amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:7--&amp;gt;&lt;br /&gt;
{{QS:mandatory}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
{{QS:relevance}}&lt;br /&gt;
&lt;br /&gt;
=Display= &amp;lt;!--T:10--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
{{QS:answer_width}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:55--&amp;gt;&lt;br /&gt;
{{QS:Hide_tip}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
{{QS:Random_order}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:56--&amp;gt;&lt;br /&gt;
{{QS:Question_theme}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:14--&amp;gt;&lt;br /&gt;
{{QS:Hidden}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:57--&amp;gt;&lt;br /&gt;
{{QS:CSS_Class}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:58--&amp;gt;&lt;br /&gt;
{{QS:Printable_survey_relevance_help}}&lt;br /&gt;
&lt;br /&gt;
=Logic= &amp;lt;!--T:59--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:21--&amp;gt;&lt;br /&gt;
{{QS:min_answers}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:22--&amp;gt;&lt;br /&gt;
{{QS:max_answers}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:16--&amp;gt;&lt;br /&gt;
{{QS:array_filter_exclude}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:60--&amp;gt;&lt;br /&gt;
{{QS:array_filter_style}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:15--&amp;gt;&lt;br /&gt;
{{QS:array_filter}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:61--&amp;gt;&lt;br /&gt;
{{QS:exclusive_option}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:12--&amp;gt;&lt;br /&gt;
{{QS:Random_group}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:47--&amp;gt;&lt;br /&gt;
{{QS:em_validation_q}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:48--&amp;gt;&lt;br /&gt;
{{QS:em_validation_q_tip}} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Other= &amp;lt;!--T:62--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:17--&amp;gt;&lt;br /&gt;
{{QS:Page_break}}&lt;br /&gt;
&lt;br /&gt;
=Statistics= &amp;lt;!--T:63--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:18--&amp;gt;&lt;br /&gt;
{{QS:Public_statistics}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:64--&amp;gt;&lt;br /&gt;
{{QS:Display_chart}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:65--&amp;gt;&lt;br /&gt;
{{QS:Chart_type}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:66--&amp;gt;&lt;br /&gt;
[[Category:Question types]][[Category:Arrays]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Question_type_-_Array_(5_point_choice)&amp;diff=125961</id>
		<title>Question type - Array (5 point choice)</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Question_type_-_Array_(5_point_choice)&amp;diff=125961"/>
		<updated>2018-09-26T11:45:02Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt; &amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Short description= &amp;lt;!--T:2--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:25--&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;/translate&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;{{#ifeq:{{{transcludesection|short_description}}}|short_description|&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;translate&amp;gt;&amp;lt;!--T:26--&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:3--&amp;gt;&lt;br /&gt;
It is an array type that is prefilled with answer choices. An 1 to 5 scale is used. A &amp;quot;No answer&amp;quot; answer option is automatically added if the question is not mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] &#039;&#039;&#039;Hint:&#039;&#039;&#039; If you need scales other than 5 points, use the general [[Question type - Array|array question type]]. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
[[File:A-5_point.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:29--&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Example:&#039;&#039;&#039; [[Media:Array_5_point_choice_example.zip|Array 5 point choice example.zip]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:27--&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;/translate&amp;gt;}}&amp;lt;/div&amp;gt;&amp;lt;/onlyinclude&amp;gt;&amp;lt;div style=&amp;quot;display:none;&amp;quot;&amp;gt;&amp;lt;translate&amp;gt;&amp;lt;!--T:28--&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General options= &amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
{{QS:mandatory}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
{{QS:relevance}}&lt;br /&gt;
&lt;br /&gt;
=Display= &amp;lt;!--T:12--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:15--&amp;gt;&lt;br /&gt;
{{QS:answer_width}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:30--&amp;gt;&lt;br /&gt;
{{QS:hide_tip}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
{{QS:Random_order}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:31--&amp;gt;&lt;br /&gt;
{{QS:Question_theme}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:16--&amp;gt;&lt;br /&gt;
{{QS:Hidden}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:32--&amp;gt;&lt;br /&gt;
{{QS:CSS_Class}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:33--&amp;gt;&lt;br /&gt;
{{QS:Printable_survey_relevance_help}}&lt;br /&gt;
&lt;br /&gt;
=Logic= &amp;lt;!--T:34--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:23--&amp;gt;&lt;br /&gt;
{{QS:min_answers}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:24--&amp;gt;&lt;br /&gt;
{{QS:max_answers}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:18--&amp;gt;&lt;br /&gt;
{{QS:array_filter_exclude}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:35--&amp;gt;&lt;br /&gt;
{{QS:array_filter_style}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:17--&amp;gt;&lt;br /&gt;
{{QS:array_filter}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:36--&amp;gt;&lt;br /&gt;
{{QS:exclusive_option}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:37--&amp;gt;&lt;br /&gt;
{{QS:Random_group}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:38--&amp;gt;&lt;br /&gt;
{{QS:em_validation_q}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:39--&amp;gt;&lt;br /&gt;
{{QS:em_validation_q_tip}}&lt;br /&gt;
&lt;br /&gt;
=Other= &amp;lt;!--T:40--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:19--&amp;gt;&lt;br /&gt;
{{QS:Page_break}}&lt;br /&gt;
&lt;br /&gt;
=Statistics= &amp;lt;!--T:41--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:20--&amp;gt;&lt;br /&gt;
{{QS:Public_statistics}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:42--&amp;gt;&lt;br /&gt;
{{QS:Display_chart}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:43--&amp;gt;&lt;br /&gt;
{{QS:Chart_type}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:44--&amp;gt;&lt;br /&gt;
[[Category:Question types]][[Category:Arrays]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=110257</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=110257"/>
		<updated>2018-05-29T19:36:58Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Version 3.x */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have sub-questions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with sub-question relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.06)&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary sub-questions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one sub-question at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the sub-question with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The sub-question code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with sub-questions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with sub-questions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with sub-questions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with sub-questions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create sub-questions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for Pricing Sliders can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last sub-questions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=110256</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=110256"/>
		<updated>2018-05-29T19:35:46Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Van Westendorp Pricing Sliders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have sub-questions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with sub-question relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.06)&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary sub-questions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one sub-question at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the sub-question with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The sub-question code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with sub-questions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with sub-questions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with sub-questions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with sub-questions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create sub-questions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 3.x ==&lt;br /&gt;
&lt;br /&gt;
A custom question theme for this can be found here - https://github.com/tpartner/LimeSurvey-Pricing-Sliders-3.x&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last sub-questions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=97620</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=97620"/>
		<updated>2018-04-13T20:38:41Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have sub-questions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with sub-question relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.06)&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary sub-questions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one sub-question at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the sub-question with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The sub-question code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06, 2.73.0, 3.6.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
==LimeSurvey version 2.06==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 2.73.0:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
==LimeSurvey version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).on(&#039;ready pjax:scriptcomplete&#039;,function(){&lt;br /&gt;
 &lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
 &lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		console.log(ansCount);&lt;br /&gt;
 &lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
 &lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with sub-questions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with sub-questions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with sub-questions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with sub-questions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create sub-questions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last sub-questions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=97619</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=97619"/>
		<updated>2018-04-13T20:04:47Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Implementation LS Version 2.54: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have sub-questions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with sub-question relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.06)&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary sub-questions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one sub-question at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the sub-question with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The sub-question code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 and 2.73.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.06:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.73.0:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 3.x:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with sub-questions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with sub-questions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with sub-questions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with sub-questions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create sub-questions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last sub-questions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=97618</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=97618"/>
		<updated>2018-04-13T19:57:02Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Implementation LS Version 2.54: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have sub-questions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with sub-question relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.06)&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary sub-questions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: Version 3.3.0+180209, Safari 11.0.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following code is an update of the above, tested with the latest LS3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
		&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
		    &lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.ls-answers&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.ls-answers tr.subquestion-list&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one sub-question at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the sub-question with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The sub-question code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 and 2.73.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.06:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.73.0:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.54:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).prop(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with sub-questions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with sub-questions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with sub-questions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with sub-questions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create sub-questions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last sub-questions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:Test_survey_names.zip&amp;diff=91443</id>
		<title>File:Test survey names.zip</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:Test_survey_names.zip&amp;diff=91443"/>
		<updated>2018-03-09T13:51:21Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: Tpartner uploaded a new version of File:Test survey names.zip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=New_Template_System_in_LS3.x&amp;diff=90217</id>
		<title>New Template System in LS3.x</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=New_Template_System_in_LS3.x&amp;diff=90217"/>
		<updated>2018-03-05T23:32:27Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Create new template options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
On this page you&#039;ll learn how to:&lt;br /&gt;
&lt;br /&gt;
* Use the new template system of LimeSurvey 3.0.&lt;br /&gt;
* Use inheritance to manage your own templates.&lt;br /&gt;
* Add a picture to your template&lt;br /&gt;
* Manage template options for your surveys and survey groups&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LimeSurvey 3 introduces a complete new template engine system, based on Twig 1.29, Bootstrap, and allowing template inheritance and template options.  It completely removes the old replacement keywords system. So now, 100% of the frontend HTML can be customized. For example, in the old template system, there was a keyword {ASSESSMENTS} that was replaced by the assessment HTML at execution time. A template designer had no way to customize this HTML (other than using JavaScript). Now, there is a file called assessments.twig that contains the logic (written in Twig) to generate this HTML. In these pages, we will give you some explanation about how to use this new template engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]]  We will not detail here how Twig works. It’s kind of very simplified PHP that offers a high level of security thanks to the “sandbox” system (we’ll see that in more detail in the part about the Template Engine Core code). If you already know PHP, it will be extremely easy for you to master. If you don’t know PHP, it still should be pretty easy to learn. Please, have a look to the Twig 1.X documentation:&lt;br /&gt;
https://twig.symfony.com/ &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Editing Using the Admin Interface=&lt;br /&gt;
==Template list==&lt;br /&gt;
On the admin dashboard, there is now a box to access the template list:&lt;br /&gt;
[[File:Template list.jpg|thumb|800px|center|baseline|border|&#039;&#039;The template list after a fresh install of RC3&#039;&#039;]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The list is divided in 5 columns:&lt;br /&gt;
* a preview of the template: it’s just a picture file called “preview.png” at the root of the template&lt;br /&gt;
* the “name” of the template: the directory name of the template. Before we release the LS3 master, it will become the template “Title” (can be different from directory name, and it can contain special cgunnarhars)&lt;br /&gt;
* the description of the template: a string set in its manifest&lt;br /&gt;
* the type of template: Core template (provided with LimeSurvey), User template (added in upload directory), XML template (not loaded in database)&lt;br /&gt;
* Extends: if the template extends another template, its name will be indicated here&lt;br /&gt;
* Some action buttons:&lt;br /&gt;
** Install: it will load the manifest of a template to add it to database and make it available for selection at the survey level&lt;br /&gt;
** Uninstall: it will delete the configuration entries of a template in the database&lt;br /&gt;
** Template editor: it will redirect you to the template editor&lt;br /&gt;
** Template option: it will lead you the global configuration of template options&lt;br /&gt;
&lt;br /&gt;
==Template Editor==&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] This documentation supposes you already know how to use the Template Editor in the previous version of LS. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The Template Editor has been kept as close as possible to the original one. So, when you open a Core Template, you can’t edit it. But now, instead of a “copy” button, you have an “extend button”.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Extends default.png|center|baseline|border|&#039;&#039;Now you &#039;&#039;&#039;extend&#039;&#039;&#039; template&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
====A quick overview of the concept of template inheritance====&lt;br /&gt;
&lt;br /&gt;
In LS3, a template can now inherit from another template, it can “extend” another template. This means that the template directory will be practically empty, it will only contain the files (views, style sheets, scripts, resources etc.) that differ from the original ones. Doing so, it will be easy for you to create a fleet of templates for your different users without having to maintain a lot of different templates. For example: you can have your own home-made template, and then a version for a company (with its logo, its style, maybe a link to its website on the footer etc.), another version for another company etc. If then you update the CSS or the global layout of your custom template, all the templates that inherit from it will be updated automatically. Note that the inheritance is recursive: a template can extend a template that extends another one etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] It also means that if you extend one of the core templates of LimeSurvey, you will still benefit from its updates.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Novelties in the user interface====&lt;br /&gt;
&lt;br /&gt;
To extend the Monochrome template of LimeSurvey, go to the Template list, click on the button “Template Editor” of the Monochrome template. Then, click on “extend” and validate the new name “extends_monochrome”.&lt;br /&gt;
&lt;br /&gt;
If you now go to the upload directory (with your file/ftp client), you’ll see that a new directory has been created: &#039;&#039;&#039;upload/templates/extends_monochrome&#039;&#039;&#039;&lt;br /&gt;
It contains an XML file and directories, but most directories are empty. It has neither views nor CSS nor JS. But, you can still select this template as a normal one from a survey and it will look exactly like the monochrome template.&lt;br /&gt;
&lt;br /&gt;
[[File:Extends monochrome empty.jpg|center|baseline|border|&#039;&#039;The template tree (directory and files) just after its creation. It&#039;s practically empty&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] The ressources (jpg, png etc.) from the original template are copied when extending a template. This is because if you copy a CSS file from the original template locally, and if it refers to those files (like in background-image statement), it will need to find those pictures in the current template path. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The template editor for the extends_monochrome template looks like that:&lt;br /&gt;
[[File:Editing extends monochrome.jpg|center|baseline|border|&#039;&#039; Editing extends_monochrome template&#039;&#039;]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
There is no big difference with the old template editor. Let’s list the main ones:&lt;br /&gt;
 &amp;lt;br /&amp;gt;&lt;br /&gt;
* The keyword &#039;&#039;&#039;inherited&#039;&#039;&#039; on the file list. It means that the file is not present in the template directory and that the file from the original template will be used.&lt;br /&gt;
[[File:Inherited.jpg|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*  The main editor ( [https://ace.c9.io ACE editor ] ) shows the content of the selected file. The files not only contain HTML, CSS or JS, but also Twig statements. Those Twig statements give us the possibility to push some logic to template views that were located deep in the core before, and that now can be customized.&lt;br /&gt;
[[File:Twig code in editor.jpg|center|&#039;&#039;Some twig code, for Survey List&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* This is why you have more screen types available in the dropdown selector of the top menu now. You’ll notice pages such as ‘Survey List’, ‘Load’, ‘Save’, ‘Error’, ‘Registration’, ‘Assessments’, ‘Print Answers’ that weren’t available before, or that you couldn’t really be customized before.&lt;br /&gt;
[[File:Newscreens editables.jpg|195px|center|&#039;&#039;Now, you can customize all screens&#039;&#039;]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
* The ‘tip’ link at the bottom of the file list gives you the Twig way to add a picture in your HTML&lt;br /&gt;
[[File:Tip picture.png|605px|center]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
* The button ‘save changes’ becomes a button &#039;&#039;&#039;Copy to local template and save changes&#039;&#039;&#039;&lt;br /&gt;
[[File:Copytolocal.png|360px|center]]&lt;br /&gt;
&lt;br /&gt;
====Quick example: adding a picture ====&lt;br /&gt;
&lt;br /&gt;
The button &#039;&#039;&#039;Copy to local template and save changes&#039;&#039;&#039; will do exactly what it says: if you edit anything inside the file and then click on that button, it will copy the file to the template you’re editing, and save your changes.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For example: click on the file layout_global.twig, then just before the block content ( {% block content %}) add the text “TEST” and click the button. You can see that the label of the file changed from “inherited” to “local” and now the button is a simple button &#039;&#039;&#039;save changes&#039;&#039;&#039;. &lt;br /&gt;
[[File:After edition.png|center|&#039;&#039;just after clicking on the button &#039;&#039;&#039; Copy to local template and save changes &#039;&#039;&#039;&#039;|]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If you open a file explorer and go to the directory upload/templates/extends_monochrome/views/, you will see that it contains only one file, the file layout_global.twig and that the string “TEST” is there.&lt;br /&gt;
[[File:Tree with layout global arrow.png|center|&#039;&#039;Now the file is present in your template&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now instead of addind a random text, we will add a picture.  If you click on the tip link, it will tell you:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To use a picture in a .twig file:&lt;br /&gt;
&#039;&#039;&#039;{{ image(&#039;./files/myfile.png&#039;, &#039;alt-text for my file&#039;, {&amp;quot;class&amp;quot;: &amp;quot;myclass&amp;quot;}) }}&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If you have read the Twig documentation (and you should have done so at this point), you know that &#039;&#039;&#039;&amp;amp;#123;&amp;amp;#123; function( ) }}&amp;lt;nowiki /&amp;gt;&#039;&#039;&#039; will echo the result of a function on screen. Here, the function is image( ). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]]  If you’re curious to know what it does, you can find it in the code here (version of RC3): [https://github.com/LimeSurvey/LimeSurvey/blob/f3737a75e428f604d68d2e5ba958f3eba3eba2e1/application/core/LS_Twig_Extension.php#L219-L237 image() function in RC3]&lt;br /&gt;
If you don’t understand the code: don’t worry, you don’t need to know how it works, but why to use it and how to use it.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
You should use the function image() for two reasons:&lt;br /&gt;
* The function image loops through the template to find the image. If the template you’re working on is extended to another template, and if you copy the file to where you inserted the picture locally, but that picture is not copied in the local template, it will loop through the template inheritance tree to find where that picture is.&lt;br /&gt;
* It will use the asset manager, so it will improve the performance of your template. See the Yii Asset Manager documentation for more information about it: http://www.yiiframework.com/wiki/148/understanding-assets/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&lt;br /&gt;
So, to add a picture to your template:&lt;br /&gt;
* just upload it as usual with the file uploader on the right and then add it to where you want it in any twig file:&lt;br /&gt;
&#039;&#039;&#039;&amp;amp;#123;&amp;amp;#123; image(&#039;./files/myfile.png&#039;) }}&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* If you want to add an alternate text for your picture (for screen readers and HTML validation), add:&lt;br /&gt;
&amp;amp;#123;&amp;amp;#123; image(&#039;./files/myfile.png&#039;), &#039;&#039;&#039; ‘my alternative text’ &#039;&#039;&#039; }}&lt;br /&gt;
&lt;br /&gt;
* If you want to add a class attribute and add an id to it:&lt;br /&gt;
&amp;amp;#123;&amp;amp;#123; image(&#039;./files/myfile.png&#039;), ‘my alternative text’, &#039;&#039;&#039; &amp;amp;#123;“class”: “a_nice_css_class”, “id”: “any_id”} &#039;&#039;&#039; }}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Some things on our TO-DO list====&lt;br /&gt;
* Give users the possibility to upload a custom preview file from the editor itself&lt;br /&gt;
* Add a button to delete the local file and return to the inherited statement&lt;br /&gt;
* Only copy the picture used in the CSS files (by listing them in the manifest as file to copy)&lt;br /&gt;
* Remind which template the current one extends (if any)&lt;br /&gt;
&lt;br /&gt;
==Template options==&lt;br /&gt;
Another novelty of LS3 is the template option page. As we’ll see later, template creators can create their own options and even their own admin option page. Here, we’ll quickly see how the option page of the Core Templates work. To access the template options at global level: click on “template options” in the template list&lt;br /&gt;
====Advanced options====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{QS:Theme editor - advanced options}}&lt;br /&gt;
&lt;br /&gt;
====Simple options====&lt;br /&gt;
&lt;br /&gt;
The Simple option page comes from the Template itself. It’s made via a twig file and some javascript inside the template/options/ directory:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/tree/develop/templates/default/options&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] This page can be completely different from a template to another, and template providers are strongly encouraged to create their own look &amp;amp; feel. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Options.png|thumb|750px|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The simple option page simply fills in the advanced form inputs. You can see it by turning on or off a setting in the simple page, and see how the related input in the advanced form is modified accordingly. For example, in Default Template’s simple options,, if you change the Bootswatch theme to “Darkly” and then click on the tab for advanced options (even without saving)  you’ll see that the field “Cssframework Css” changed from&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#123;&amp;quot;replace&amp;quot;: &amp;amp;#91;&amp;amp;#91;&amp;quot;css/bootstrap.css&amp;quot;,&amp;quot;css/flatly.css&amp;quot;]]}&amp;lt;br&amp;gt;&lt;br /&gt;
to&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;#123;&amp;quot;replace&amp;quot;: &amp;amp;#91;&amp;amp;#91;&amp;quot;css/bootstrap.css&amp;quot;,&amp;quot;css/darkly.css&amp;quot;]]}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here are the different simple options for the Core templates:&lt;br /&gt;
*&#039;&#039;&#039;Ajax mode:&#039;&#039;&#039; Should the next page be loaded via ajax (faster) or via page reload (better for debugging purpose)&lt;br /&gt;
*&#039;&#039;&#039;Background image:&#039;&#039;&#039; if set to Yes, the image called pattern.png will be loaded (will be replaced by a file selector in Master)&lt;br /&gt;
*&#039;&#039;&#039;Box container:&#039;&#039;&#039; if set to No, the questions will not be contained in a box (so you can use large arrays bigger than the screen width)&lt;br /&gt;
*&#039;&#039;&#039;Brandlogo:&#039;&#039;&#039; if set to no, the name of the survey will be shown in top bar, else, you can select one of the pictures inside the file directory to be used as logo picture.&lt;br /&gt;
*&#039;&#039;&#039;Animate body:&#039;&#039;&#039; if set to yes, you can choose one of the animations to apply when the body of the survey is loaded&lt;br /&gt;
*&#039;&#039;&#039;Animate question:&#039;&#039;&#039; same with questions&lt;br /&gt;
*&#039;&#039;&#039;Animate alerts:&#039;&#039;&#039; same with alerts&lt;br /&gt;
*&#039;&#039;&#039;Bootstrap theme:&#039;&#039;&#039; here, you can choose a Bootstrap theme to load. They come from Bootswatch https://bootswatch.com/3/&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The library used for animations is animate.css: https://daneden.github.io/animate.css/&lt;br /&gt;
Of course, a template provider could add his own animation library or no animation library at all.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] The monochrome templates use the same bootstrap color theme as the admin user interface. They’re not using the css framework replacement system, but simply add a CSS file. So, it illustrates another way to deal with custom themes for template providers.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Inheritance system====&lt;br /&gt;
&lt;br /&gt;
In the previous part, we’ve seen that a template can extend another template. A template configuration can also inherit from another template configuration. It means that for a given template, you can have a configuration at &lt;br /&gt;
&lt;br /&gt;
* global level (the one we’ve just seen accessible from the template list)&lt;br /&gt;
* at survey group level&lt;br /&gt;
* a last one at survey level. &lt;br /&gt;
&lt;br /&gt;
Each parameter at a certain level can inherit from the upper level: survey group inheritance. First, let’s see the survey group level.&lt;br /&gt;
&lt;br /&gt;
======At survey group level======&lt;br /&gt;
&lt;br /&gt;
Indeed, one of the other great novelties of LS3 is the survey group system. You can now create different groups to organize your surveys. To access it, go to the survey list and then click on the survey group tab:&lt;br /&gt;
[[File:Surveygroup.png|thumb|800px|center|&#039;&#039;The survey groups tab&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
In this list, you have two action buttons. If the group is empty, you can delete it. Else, you can always edit it. By clicking on the edit button, you reach the Survey Group configuration page:&lt;br /&gt;
[[File:Surveygroupedit.png|thumb|800px|center|&#039;&#039;Editing Default Survey Group&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The third tab of this page is called “Template options for this survey group”. If you click on it, you’ll see the same list of templates than in the template list, except that here only the option button is visible (template editor can be reached only from the main list).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Now, if you click on the option for Default Template, you’ll see this:&lt;br /&gt;
[[File:Option group inherit.png|thumb|800px|center|&#039;&#039;At Survey Group, Template Options are inherited by default&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Inherit everything&#039;&#039;&#039; means that all the configuration will be inherited from the Global configuration level. &lt;br /&gt;
* If you go to the &#039;&#039;&#039;advanced options page&#039;&#039;&#039;, you’ll see that all the fields are set to inherit.&lt;br /&gt;
* If you click on &amp;quot;no&amp;quot; for &amp;quot;Inherit everything&amp;quot;  in the simple options, you’ll again see a very similar page to the global option page. The only difference is that for each field, you can set it to yes, no, or inherit; and each dropdown selector has an &#039;&#039;inherit&#039;&#039;&#039; value.  &lt;br /&gt;
[[File:Inherit group.png|thumb|800px|center|&#039;&#039;Each setting can have a inherited value&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] A survey group can be a child of another group. In this case, it will inherit from its parent.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======At survey level======&lt;br /&gt;
When editing a survey, in the left bar menu, you’ll see a new entry “Template Options”. It will lead you to the option page of the Template selected for the current survey. You’ll find the same inheritance system as in the survey group, but this time, inherit means that the setting will be inherited from the Survey Group of the survey.  &lt;br /&gt;
[[File:Options survey.png|thumb|800px|center|&#039;&#039;Template Options at Survey Level&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
==Use case example==&lt;br /&gt;
Let’s say you’re using a single template for different companies (A and B). You set your favorites options at global level (e.g.: ajax on, animate body with a slide in, alerts with a pulse). Then you create a survey group for each company: a survey group for company A that will host all the surveys for this company, and a survey for company B that will host all the surveys for company B. At this level, you’ll set the logo and the background only, and you will let the other options to inherit. So, all the surveys in group A will use the logo from the company A, and all the survey from group B the logo from company B. For one of the surveys of company A, you could use a different background in relation with the topic of the survey: you just change the background in options at survey level. If someone in company B tells you that the pulsing alert is too aggressive and he would prefer something smoother like a fade in, you just change the alert animation at the Survey Group B level and all the surveys of this group will now use this animation. If the company A changes its logo, you can change it at the level of Survey Group A, and all the surveys of this group will use the new logo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Those examples are based on the current options of the core template. But of course, if you are a template provider, or if you’re able to script a bit with twig, you can add your own options. For example, you could add an option “info footer” where you could add data like the company website or a phone number for help. Then, if company A has different departments, with different phone numbers, you can just create one sub-group for each department in Survey Group A. Each subgroup will have its own phone number in these options.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= FAQ about theme customization =&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find here some answers to questions that have been asked in the forum and that could help you to customize your theme.&lt;br /&gt;
&lt;br /&gt;
==Customizing CSS: deal with the asset manager (&amp;quot;why my changes are not applied?&amp;quot;) ==&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;re trying to update the CSS of a theme by directly editing the code with your favorite editor, you could be surprised that your changes are not applied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since 2.50, LS use the Yii asset manager:&lt;br /&gt;
[http://www.yiiframework.com/wiki/148/understanding-assets/  Yii Documentation about Assets]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It moves the CSS files of a theme to a tmp/ sub-directory with a random string (eg: &amp;quot;tmp/1ef64ml/&amp;quot;). So if you make any change to a css file, and tell it to the asset manager, the files are copied to a new sub-directory with a new name so the user browser&#039;s cache is updated and they see the new css. Else, they would have to clean their browser cache. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the CSS links in header when asset manager is on:&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Assets on vanilla.jpg]]&lt;br /&gt;
&amp;lt;br /&amp;gt;As you can see they all refer to the tmp/ subfolders. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the CSS links in header when asset manager is off:&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Asset off.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;As you can see they point to the real files of the theme. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] Of course, if the Asset Manager doesn&#039;t know you changed the file, the old file from the old tmp/directory remain unchanged, and your changes will never be applied..&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, when you&#039;re editing CSS of a theme you have various possibilities:&lt;br /&gt;
*&#039;&#039;&#039;You can use the the LS Theme Editor:&#039;&#039;&#039; it deals with the asset manager and you don&#039;t have to worry about anything&lt;br /&gt;
*&#039;&#039;&#039;You can turn debug mode on:&#039;&#039;&#039; it will turn asset manager off, so the real css/js files of your themes are called (but then, you have to refresh your browser cache at each load)&lt;br /&gt;
* &#039;&#039;&#039;You can refresh the  assets cache&#039;&#039;&#039;: from Global Settings -&amp;gt; General -&amp;gt; Clear asset cache&lt;br /&gt;
&lt;br /&gt;
[[File:Clearassets-ls3 3.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] &#039;&#039;&#039;Using the theme editor to edit the custom CSS is by far the best solution.&#039;&#039;&#039; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the theme editor will help you to understand the architecture of the new theme engine.&lt;br /&gt;
Also, if your customizing fruity, be careful with CSS specifity: most of the definitions use the selector &amp;quot;.fruity&amp;quot; (one of the class of the body element)&lt;br /&gt;
&lt;br /&gt;
== Adding custom fonts to my theme ==&lt;br /&gt;
=== The easy way: using Google Font CDN  ===&lt;br /&gt;
Bootswatch Survey Theme uses Google Font CDN. Let&#039;s have a look to how ti works:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/bootswatch/css/variations/flatly.min.css&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
@import url(&amp;quot;https://fonts.googleapis.com/css?family=Lato:400,700,400italic&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Lato font is used via CSS rules:&lt;br /&gt;
https://github.com/thomaspark/bootswatch/blob/master/dist/flatly/bootstrap.css#L72&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
body {&lt;br /&gt;
  ...&lt;br /&gt;
 font-family: &amp;quot;Lato&amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use any google font that way in your custom theme. Of course, you should remove the font selector from the options of your theme. Delete those lines in options.twig:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/options/options.twig#L209-L230&lt;br /&gt;
&lt;br /&gt;
=== Using local font  ===&lt;br /&gt;
Of course, you can also download the font files and use them from local server rather than from Google CDN (better for privacy). To have an example of how to it, here our local version of noto font:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/assets/fonts/noto.css&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
  font-family: &#039;Noto Sans&#039;;&lt;br /&gt;
  font-weight: 300;&lt;br /&gt;
  font-style: normal;&lt;br /&gt;
  src: url(&#039;./font-src/Noto/NotoSans-Regular.ttf&#039;);&lt;br /&gt;
}&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use a very similar definition in your theme css file, and then by copying the file NotoSans-Regular.ttf  in your theme css/font-src/ folder. &lt;br /&gt;
&lt;br /&gt;
Then, apply that font to your body (or any other element) like above, and remove the default option font selector.&lt;br /&gt;
&lt;br /&gt;
=== Creating your own font selector in options  ===&lt;br /&gt;
For now, you can&#039;t easily use the core font selector to add your own font in options. We need first to give the possibility to end user to upload custom packages (see next paragraph: A look into the Fruity Font Selector ) &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here how to proceed:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*Add two fonts (my_custom_font and my_custom_other_font) into your theme, using CDN or local server &lt;br /&gt;
*Then, in your css file, add two new classes:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.font-my_custom_font {&lt;br /&gt;
 font-family: &#039;my_custom_font &#039;;&lt;br /&gt;
}&lt;br /&gt;
.font-my_custom_other_font {&lt;br /&gt;
 font-family: &#039;my_custom_other_font&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*In the XML file of your theme, add a font option (default one will be my_custom_font) :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;options&amp;gt;&lt;br /&gt;
        ....&lt;br /&gt;
        &amp;lt;font&amp;gt;my_custom_font&amp;lt;/font&amp;gt;&lt;br /&gt;
    &amp;lt;/options&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* in option.twig, add you font picker adding those lines (untested for now, so come complain to the forum if it doesn&#039;t work):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
            &lt;br /&gt;
            &amp;lt;div class=&#039;row ls-space margin top-15 bottom-15 action_hide_on_inherit&#039;&amp;gt;&lt;br /&gt;
                &amp;lt;hr/&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&#039;row action_hide_on_inherit&#039;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&#039;panel panel-default&#039;&amp;gt;&lt;br /&gt;
                        &amp;lt;div class=&#039;panel-heading&#039;&amp;gt;{{ &amp;quot;My custom fonts&amp;quot; | t }}&amp;lt;/div&amp;gt;&lt;br /&gt;
                        &amp;lt;div class=&#039;panel-body&#039;&amp;gt;&lt;br /&gt;
                            &amp;lt;div class=&#039;form-group row&#039;&amp;gt;&lt;br /&gt;
                                &amp;lt;label for=&#039;simple_edit_font&#039; class=&#039;control-label&#039;&amp;gt;{{ &amp;quot;Select font:&amp;quot; | t }}&amp;lt;/label&amp;gt;&lt;br /&gt;
                                &amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
                                    &amp;lt;select class=&#039;form-control selector_option_value_field&#039; id=&#039;simple_edit_font&#039; name=&#039;font&#039;&amp;gt;&lt;br /&gt;
                                    {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}&lt;br /&gt;
                                        {% set fontOptions = fontOptions ~ &#039;&amp;lt;option value = &amp;quot;inherit&amp;quot; &amp;gt; Inherit&amp;lt;/option&amp;gt;&#039; %}&lt;br /&gt;
                                    {% endif %}&lt;br /&gt;
                                   &amp;lt;optgroup  label=&amp;quot;{{ &amp;quot;My Custom fonts&amp;quot; | t }}&amp;quot;&amp;gt;&lt;br /&gt;
                                   &amp;lt;option class=&amp;quot;font-my_custom_font&amp;quot;     value=&amp;quot;custom_font&amp;quot;   data-font-package=&amp;quot;&amp;quot;  &amp;gt;Custom&amp;lt;/option&amp;gt;&lt;br /&gt;
                                  &amp;lt;option class=&amp;quot;font-my_custom_other_font&amp;quot; value=&amp;quot;my_custom_other_font&amp;quot; data-font-package=&amp;quot;&amp;quot;  &amp;gt;Other&amp;lt;/option&amp;gt;&lt;br /&gt;
                                  &amp;lt;/optgroup&amp;gt;&lt;br /&gt;
                                   &lt;br /&gt;
                                    &amp;lt;/select&amp;gt;&lt;br /&gt;
                                &amp;lt;/div&amp;gt;&lt;br /&gt;
                            &amp;lt;/div&amp;gt;&lt;br /&gt;
                        &amp;lt;/div&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Now your users should be able to choose between those two fonts.&lt;br /&gt;
&lt;br /&gt;
=== A look into the Fruity Font Selector ===&lt;br /&gt;
In the future, we&#039;ll give the possibility to final user to upload their own asset packages, including font packages. It will make very easy any customization of fonts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To understand Yii Packages:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.yiiframework.com/doc/api/1.1/CClientScript#packages-detail&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
LimeSurvey packages are defined in different files. Fonts packages are defined here:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/4c40b61afb0dba8fd80154b50f5831045df8d814/application/config/fonts.php&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For example, the Noto font package is defined here:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/4c40b61afb0dba8fd80154b50f5831045df8d814/application/config/fonts.php#L47-L53&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &#039;font-noto&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;devBaseUrl&#039; =&amp;gt; &#039;assets/fonts/&#039;,&lt;br /&gt;
        &#039;basePath&#039; =&amp;gt; &#039;fonts&#039;,&lt;br /&gt;
        &#039;css&#039; =&amp;gt; array(&lt;br /&gt;
            &#039;noto.css&#039;,&lt;br /&gt;
        ),&lt;br /&gt;
    ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The noto.css file it contains is here:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/4c40b61afb0dba8fd80154b50f5831045df8d814/assets/fonts/noto.css&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Notice the definition of the css class &amp;quot;.font-noto&amp;quot; at the end of it:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
  font-family: &#039;Noto Sans&#039;;&lt;br /&gt;
  ...&lt;br /&gt;
}&lt;br /&gt;
...&lt;br /&gt;
.font-noto{&lt;br /&gt;
    font-family: &#039;Noto Sans&#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, in Vanilla Theme, noto font is used by adding the noto package and defining the font option to noto:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/config.xml#L79&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;packages&amp;gt;&lt;br /&gt;
             ....&lt;br /&gt;
            &amp;lt;add&amp;gt;font-noto&amp;lt;/add&amp;gt;&lt;br /&gt;
        &amp;lt;/packages&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight &amp;gt;&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/config.xml#L58&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;options&amp;gt;&lt;br /&gt;
        ....&lt;br /&gt;
        &amp;lt;font&amp;gt;noto&amp;lt;/font&amp;gt;&lt;br /&gt;
    &amp;lt;/options&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, the body class font is defined using this value:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/views/layout_global.twig#L76&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;body class=&amp;quot; ...  font-{{  aSurveyInfo.options.font }} ... &amp;quot; ... &amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, the XML file only contains the default values for your template configuration. But indeed, those values are defined and read inside the database (table &amp;quot;template_configuration&amp;quot;) as json strings. The option.js file just use the value of the font selector of the simple option to change the value inside the advanced tab form:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/options/options.js#L148-L174&lt;br /&gt;
&lt;br /&gt;
So when the &amp;quot;upload asset package&amp;quot; functionality will be available, it will be easy to add a script that scan all the existing font packages to add them in the selector.&lt;br /&gt;
&lt;br /&gt;
== Adding theme options to control positioning and display of survey elements  ==&lt;br /&gt;
This tutorial will show how to add options to an extended theme to display survey elements in various locations. In this case, we will create theme options to show the survey title in two different locations.&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] For the sake of simplicity, we will base the tutorial on an extension of the &amp;quot;bootswatch&amp;quot; theme in LimeSurvey version 3.4.3.&amp;lt;/div&amp;gt;  &lt;br /&gt;
=== Create a custom theme  ===&lt;br /&gt;
#Extend the &amp;quot;bootswatch&amp;quot; theme as described above.&lt;br /&gt;
#Copy &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;custom.css&amp;lt;/span&amp;gt; to the local template as described above.&lt;br /&gt;
===Create new template options===&lt;br /&gt;
#Copy the contents of &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/bootswatch/options/&amp;lt;/span&amp;gt; to &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/options/&amp;lt;/span&amp;gt;.&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/options/options.twig&amp;lt;/span&amp;gt; in an editor and find &amp;quot;{# Bootstrap Bootswatch theme #}&amp;quot;. Directly before its parent  &amp;lt;nowiki&amp;gt;&amp;lt;div class=&#039;row&#039;&amp;gt;&amp;lt;/nowiki&amp;gt; element, add this:&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
		{# Custom survey name in navbar #}&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;div class=&#039;col-sm-12 col-md-6&#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;div class=&#039;form-group row&#039;&amp;gt;&lt;br /&gt;
					&amp;lt;label for=&#039;simple_edit_options_surveyname1&#039; class=&#039;control-label&#039;&amp;gt;Survey name in navbar&amp;lt;/label&amp;gt;&lt;br /&gt;
					&amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
						&amp;lt;div class=&amp;quot;btn-group&amp;quot; data-toggle=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname1&#039; type=&#039;radio&#039; value=&#039;on&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname1&#039;/&amp;gt;&lt;br /&gt;
								Yes&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname1&#039; type=&#039;radio&#039; value=&#039;off&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname1&#039;/&amp;gt;&lt;br /&gt;
								No&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
						&amp;lt;/div&amp;gt;&lt;br /&gt;
					&amp;lt;/div&amp;gt;&lt;br /&gt;
				&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;hr/&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		{# Custom survey name below progress bar #}&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;div class=&#039;col-sm-12 col-md-6&#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;div class=&#039;form-group row&#039;&amp;gt;&lt;br /&gt;
					&amp;lt;label for=&#039;simple_edit_options_surveyname2&#039; class=&#039;control-label&#039;&amp;gt;Survey name below progress bar&amp;lt;/label&amp;gt;&lt;br /&gt;
					&amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
						&amp;lt;div class=&amp;quot;btn-group&amp;quot; data-toggle=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname2&#039; type=&#039;radio&#039; value=&#039;on&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname2&#039;/&amp;gt;&lt;br /&gt;
								Yes&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname2&#039; type=&#039;radio&#039; value=&#039;off&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname2&#039;/&amp;gt;&lt;br /&gt;
								No&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
						&amp;lt;/div&amp;gt;&lt;br /&gt;
					&amp;lt;/div&amp;gt;&lt;br /&gt;
				&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;hr/&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/config.xml&amp;lt;/span&amp;gt; and add two items to the &amp;quot;options&amp;quot; block so it looks like this:&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;    &amp;lt;options&amp;gt;&lt;br /&gt;
        &amp;lt;ajaxmode&amp;gt;on&amp;lt;/ajaxmode&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        &amp;lt;surveyname1&amp;gt;on&amp;lt;/surveyname1&amp;gt;&lt;br /&gt;
        &amp;lt;surveyname2&amp;gt;on&amp;lt;/surveyname2&amp;gt;&lt;br /&gt;
    &amp;lt;/options&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#This should give you two new options in the Theme Options screen like this:&amp;lt;br /&amp;gt;[[File:Tutorial_tp_1_1.png]]&lt;br /&gt;
&lt;br /&gt;
===Modifed view for Survey Title in the navbar===&lt;br /&gt;
#Create a new directory &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/views/subviews/header/&amp;lt;/span&amp;gt;.&lt;br /&gt;
#Copy &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/header/nav_bar.twig&amp;lt;/span&amp;gt; to that new directory.&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/header/nav_bar.twig&amp;lt;/span&amp;gt; and find &amp;quot;{# Logo option #}&amp;quot;. Under that, modify the IF statement for the logo/survey-name, so it looks like this:&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
		{# Logo option #}&lt;br /&gt;
        {% if( aSurveyInfo.options.brandlogo == &amp;quot;on&amp;quot;) %}&lt;br /&gt;
            &amp;lt;div class=&amp;quot;{{ aSurveyInfo.class.navbarbrand }} logo-container&amp;quot;  {{ aSurveyInfo.attr.navbarbrand }}  &amp;gt;&lt;br /&gt;
                {{ image(aSurveyInfo.options.brandlogofile, aSurveyInfo.name, {&amp;quot;class&amp;quot;: &amp;quot;logo img-responsive&amp;quot;}) }}&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        {% endif %}&lt;br /&gt;
        {% if( aSurveyInfo.options.surveyname1 == &amp;quot;on&amp;quot;) %}&lt;br /&gt;
            &amp;lt;div class=&amp;quot;{{ aSurveyInfo.class.navbarbrand }}&amp;quot;  {{ aSurveyInfo.attr.navbarbrand }} &amp;gt;&lt;br /&gt;
                {{ aSurveyInfo.name }}&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        {% endif %}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add something like this to &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/css/custom.css&amp;lt;/span&amp;gt;:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.navbar-brand {&lt;br /&gt;
    line-height: 60px;&lt;br /&gt;
    font-size: 32px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Toggle the &amp;quot;Survey name in navbar&amp;quot; theme option to &amp;quot;Yes&amp;quot;&lt;br /&gt;
#You should see this:&amp;lt;br /&amp;gt;[[File:Tutorial_tp_1_2.png]]&lt;br /&gt;
===Modifed view for Survey Title under progress bar===&lt;br /&gt;
#Create a new directory &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/views/subviews/survey/group_subviews&amp;lt;/span&amp;gt;.&lt;br /&gt;
#Copy &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/survey/group_subviews/group_container.twig&amp;lt;/span&amp;gt; to that new directory.&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/survey/group_subviews/group_container.twig&amp;lt;/span&amp;gt; and add an &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;/nowiki&amp;gt; element for the survey name. So it looks like this:&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;{{ aSurveyInfo.class.groupcontainer }} space-col&amp;quot; {{ aSurveyInfo.attr.groupcontainer }}&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    {# Custom survey name #}&lt;br /&gt;
    {% if( aSurveyInfo.options.surveyname2 == &amp;quot;on&amp;quot;) %}&lt;br /&gt;
    	&amp;lt;h1 class=&amp;quot;custom-survey-name&amp;quot;&amp;gt;{{ aSurveyInfo.name }}&amp;lt;/h1&amp;gt;&lt;br /&gt;
    {% endif %}&lt;br /&gt;
 &lt;br /&gt;
    {# Group Name #}&lt;br /&gt;
    {{ include(&#039;./subviews/survey/group_subviews/group_name.twig&#039;) }}&lt;br /&gt;
 &lt;br /&gt;
    {# Group Description #}&lt;br /&gt;
    {{ include(&#039;./subviews/survey/group_subviews/group_desc.twig&#039;) }}&lt;br /&gt;
 &lt;br /&gt;
    {#&lt;br /&gt;
        PRESENT THE QUESTIONS&lt;br /&gt;
 &lt;br /&gt;
        This is the main part. It will render each question for this group&lt;br /&gt;
     #}&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;!-- PRESENT THE QUESTIONS --&amp;gt;&lt;br /&gt;
    {% for  aQuestion in aGroup.aQuestions %}&lt;br /&gt;
         {{ include(&#039;./subviews/survey/question_container.twig&#039;) }}&lt;br /&gt;
    {% endfor %}&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;!-- Hidden inputs --&amp;gt;&lt;br /&gt;
    {% if aGroup.show_last_group == true %}&lt;br /&gt;
        &amp;lt;input type=&#039;hidden&#039; name=&#039;lastgroup&#039; value=&#039;{{ aGroup.lastgroup }}&#039; id=&#039;lastgroup&#039; /&amp;gt;&lt;br /&gt;
    {% endif %}&lt;br /&gt;
 &lt;br /&gt;
    {% if aGroup.show_last_answer == true %}&lt;br /&gt;
        &amp;lt;input type=&#039;hidden&#039; name=&#039;lastanswer&#039; value=&#039;{{ aGroup.lastanswer }}&#039; id=&#039;lastanswer&#039; /&amp;gt;&lt;br /&gt;
    {% endif %}&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Add something like this to &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/css/custom.css&amp;lt;/span&amp;gt;:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.navbar-brand {&lt;br /&gt;
    line-height: 60ph1.custom-survey-name {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Toggle the &amp;quot;Survey name below progress bar&amp;quot; theme option to &amp;quot;Yes&amp;quot;&lt;br /&gt;
#You should see this:&amp;lt;br /&amp;gt;[[File:Tutorial_tp_1_3.png]]&lt;br /&gt;
&lt;br /&gt;
===Downloads===&lt;br /&gt;
* Sample extended theme: [[Media:Test_survey_names.zip]]&lt;br /&gt;
&lt;br /&gt;
=Creating a template from scratch=&lt;br /&gt;
Documentation coming soon...&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;:  if you edit the XML file of a theme, you must uninstall and reinstall the theme so it&#039;s taken into account. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;:  to avoid that, you can force the use to the XML rather than DB. In config.php turn debug mode on and uncommment:&lt;br /&gt;
&lt;br /&gt;
&#039;force_xmlsettings_for_survey_rendering&#039; =&amp;gt; true, // Uncomment if you want to force the use of the XML file rather than DB (for easy theme development) &lt;br /&gt;
&lt;br /&gt;
Becareful: everything will be loaded from the XML (included options, etc)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;:  if you manually edit the CSS/JS files (without using the Teeme Editor), and if debug mode is off, you can now force the asset to be flushed. In &amp;quot;Global Settings&amp;quot;, &amp;quot;General tab&amp;quot;, click the button &amp;quot;Clear assets cache:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=New_Template_System_in_LS3.x&amp;diff=90216</id>
		<title>New Template System in LS3.x</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=New_Template_System_in_LS3.x&amp;diff=90216"/>
		<updated>2018-03-05T23:30:23Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Adding theme options to control positioning and display of survey elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
On this page you&#039;ll learn how to:&lt;br /&gt;
&lt;br /&gt;
* Use the new template system of LimeSurvey 3.0.&lt;br /&gt;
* Use inheritance to manage your own templates.&lt;br /&gt;
* Add a picture to your template&lt;br /&gt;
* Manage template options for your surveys and survey groups&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LimeSurvey 3 introduces a complete new template engine system, based on Twig 1.29, Bootstrap, and allowing template inheritance and template options.  It completely removes the old replacement keywords system. So now, 100% of the frontend HTML can be customized. For example, in the old template system, there was a keyword {ASSESSMENTS} that was replaced by the assessment HTML at execution time. A template designer had no way to customize this HTML (other than using JavaScript). Now, there is a file called assessments.twig that contains the logic (written in Twig) to generate this HTML. In these pages, we will give you some explanation about how to use this new template engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]]  We will not detail here how Twig works. It’s kind of very simplified PHP that offers a high level of security thanks to the “sandbox” system (we’ll see that in more detail in the part about the Template Engine Core code). If you already know PHP, it will be extremely easy for you to master. If you don’t know PHP, it still should be pretty easy to learn. Please, have a look to the Twig 1.X documentation:&lt;br /&gt;
https://twig.symfony.com/ &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Editing Using the Admin Interface=&lt;br /&gt;
==Template list==&lt;br /&gt;
On the admin dashboard, there is now a box to access the template list:&lt;br /&gt;
[[File:Template list.jpg|thumb|800px|center|baseline|border|&#039;&#039;The template list after a fresh install of RC3&#039;&#039;]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The list is divided in 5 columns:&lt;br /&gt;
* a preview of the template: it’s just a picture file called “preview.png” at the root of the template&lt;br /&gt;
* the “name” of the template: the directory name of the template. Before we release the LS3 master, it will become the template “Title” (can be different from directory name, and it can contain special cgunnarhars)&lt;br /&gt;
* the description of the template: a string set in its manifest&lt;br /&gt;
* the type of template: Core template (provided with LimeSurvey), User template (added in upload directory), XML template (not loaded in database)&lt;br /&gt;
* Extends: if the template extends another template, its name will be indicated here&lt;br /&gt;
* Some action buttons:&lt;br /&gt;
** Install: it will load the manifest of a template to add it to database and make it available for selection at the survey level&lt;br /&gt;
** Uninstall: it will delete the configuration entries of a template in the database&lt;br /&gt;
** Template editor: it will redirect you to the template editor&lt;br /&gt;
** Template option: it will lead you the global configuration of template options&lt;br /&gt;
&lt;br /&gt;
==Template Editor==&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] This documentation supposes you already know how to use the Template Editor in the previous version of LS. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The Template Editor has been kept as close as possible to the original one. So, when you open a Core Template, you can’t edit it. But now, instead of a “copy” button, you have an “extend button”.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Extends default.png|center|baseline|border|&#039;&#039;Now you &#039;&#039;&#039;extend&#039;&#039;&#039; template&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
====A quick overview of the concept of template inheritance====&lt;br /&gt;
&lt;br /&gt;
In LS3, a template can now inherit from another template, it can “extend” another template. This means that the template directory will be practically empty, it will only contain the files (views, style sheets, scripts, resources etc.) that differ from the original ones. Doing so, it will be easy for you to create a fleet of templates for your different users without having to maintain a lot of different templates. For example: you can have your own home-made template, and then a version for a company (with its logo, its style, maybe a link to its website on the footer etc.), another version for another company etc. If then you update the CSS or the global layout of your custom template, all the templates that inherit from it will be updated automatically. Note that the inheritance is recursive: a template can extend a template that extends another one etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] It also means that if you extend one of the core templates of LimeSurvey, you will still benefit from its updates.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Novelties in the user interface====&lt;br /&gt;
&lt;br /&gt;
To extend the Monochrome template of LimeSurvey, go to the Template list, click on the button “Template Editor” of the Monochrome template. Then, click on “extend” and validate the new name “extends_monochrome”.&lt;br /&gt;
&lt;br /&gt;
If you now go to the upload directory (with your file/ftp client), you’ll see that a new directory has been created: &#039;&#039;&#039;upload/templates/extends_monochrome&#039;&#039;&#039;&lt;br /&gt;
It contains an XML file and directories, but most directories are empty. It has neither views nor CSS nor JS. But, you can still select this template as a normal one from a survey and it will look exactly like the monochrome template.&lt;br /&gt;
&lt;br /&gt;
[[File:Extends monochrome empty.jpg|center|baseline|border|&#039;&#039;The template tree (directory and files) just after its creation. It&#039;s practically empty&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] The ressources (jpg, png etc.) from the original template are copied when extending a template. This is because if you copy a CSS file from the original template locally, and if it refers to those files (like in background-image statement), it will need to find those pictures in the current template path. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The template editor for the extends_monochrome template looks like that:&lt;br /&gt;
[[File:Editing extends monochrome.jpg|center|baseline|border|&#039;&#039; Editing extends_monochrome template&#039;&#039;]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
There is no big difference with the old template editor. Let’s list the main ones:&lt;br /&gt;
 &amp;lt;br /&amp;gt;&lt;br /&gt;
* The keyword &#039;&#039;&#039;inherited&#039;&#039;&#039; on the file list. It means that the file is not present in the template directory and that the file from the original template will be used.&lt;br /&gt;
[[File:Inherited.jpg|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*  The main editor ( [https://ace.c9.io ACE editor ] ) shows the content of the selected file. The files not only contain HTML, CSS or JS, but also Twig statements. Those Twig statements give us the possibility to push some logic to template views that were located deep in the core before, and that now can be customized.&lt;br /&gt;
[[File:Twig code in editor.jpg|center|&#039;&#039;Some twig code, for Survey List&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* This is why you have more screen types available in the dropdown selector of the top menu now. You’ll notice pages such as ‘Survey List’, ‘Load’, ‘Save’, ‘Error’, ‘Registration’, ‘Assessments’, ‘Print Answers’ that weren’t available before, or that you couldn’t really be customized before.&lt;br /&gt;
[[File:Newscreens editables.jpg|195px|center|&#039;&#039;Now, you can customize all screens&#039;&#039;]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
* The ‘tip’ link at the bottom of the file list gives you the Twig way to add a picture in your HTML&lt;br /&gt;
[[File:Tip picture.png|605px|center]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
* The button ‘save changes’ becomes a button &#039;&#039;&#039;Copy to local template and save changes&#039;&#039;&#039;&lt;br /&gt;
[[File:Copytolocal.png|360px|center]]&lt;br /&gt;
&lt;br /&gt;
====Quick example: adding a picture ====&lt;br /&gt;
&lt;br /&gt;
The button &#039;&#039;&#039;Copy to local template and save changes&#039;&#039;&#039; will do exactly what it says: if you edit anything inside the file and then click on that button, it will copy the file to the template you’re editing, and save your changes.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For example: click on the file layout_global.twig, then just before the block content ( {% block content %}) add the text “TEST” and click the button. You can see that the label of the file changed from “inherited” to “local” and now the button is a simple button &#039;&#039;&#039;save changes&#039;&#039;&#039;. &lt;br /&gt;
[[File:After edition.png|center|&#039;&#039;just after clicking on the button &#039;&#039;&#039; Copy to local template and save changes &#039;&#039;&#039;&#039;|]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If you open a file explorer and go to the directory upload/templates/extends_monochrome/views/, you will see that it contains only one file, the file layout_global.twig and that the string “TEST” is there.&lt;br /&gt;
[[File:Tree with layout global arrow.png|center|&#039;&#039;Now the file is present in your template&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now instead of addind a random text, we will add a picture.  If you click on the tip link, it will tell you:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To use a picture in a .twig file:&lt;br /&gt;
&#039;&#039;&#039;{{ image(&#039;./files/myfile.png&#039;, &#039;alt-text for my file&#039;, {&amp;quot;class&amp;quot;: &amp;quot;myclass&amp;quot;}) }}&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If you have read the Twig documentation (and you should have done so at this point), you know that &#039;&#039;&#039;&amp;amp;#123;&amp;amp;#123; function( ) }}&amp;lt;nowiki /&amp;gt;&#039;&#039;&#039; will echo the result of a function on screen. Here, the function is image( ). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]]  If you’re curious to know what it does, you can find it in the code here (version of RC3): [https://github.com/LimeSurvey/LimeSurvey/blob/f3737a75e428f604d68d2e5ba958f3eba3eba2e1/application/core/LS_Twig_Extension.php#L219-L237 image() function in RC3]&lt;br /&gt;
If you don’t understand the code: don’t worry, you don’t need to know how it works, but why to use it and how to use it.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
You should use the function image() for two reasons:&lt;br /&gt;
* The function image loops through the template to find the image. If the template you’re working on is extended to another template, and if you copy the file to where you inserted the picture locally, but that picture is not copied in the local template, it will loop through the template inheritance tree to find where that picture is.&lt;br /&gt;
* It will use the asset manager, so it will improve the performance of your template. See the Yii Asset Manager documentation for more information about it: http://www.yiiframework.com/wiki/148/understanding-assets/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&lt;br /&gt;
So, to add a picture to your template:&lt;br /&gt;
* just upload it as usual with the file uploader on the right and then add it to where you want it in any twig file:&lt;br /&gt;
&#039;&#039;&#039;&amp;amp;#123;&amp;amp;#123; image(&#039;./files/myfile.png&#039;) }}&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* If you want to add an alternate text for your picture (for screen readers and HTML validation), add:&lt;br /&gt;
&amp;amp;#123;&amp;amp;#123; image(&#039;./files/myfile.png&#039;), &#039;&#039;&#039; ‘my alternative text’ &#039;&#039;&#039; }}&lt;br /&gt;
&lt;br /&gt;
* If you want to add a class attribute and add an id to it:&lt;br /&gt;
&amp;amp;#123;&amp;amp;#123; image(&#039;./files/myfile.png&#039;), ‘my alternative text’, &#039;&#039;&#039; &amp;amp;#123;“class”: “a_nice_css_class”, “id”: “any_id”} &#039;&#039;&#039; }}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Some things on our TO-DO list====&lt;br /&gt;
* Give users the possibility to upload a custom preview file from the editor itself&lt;br /&gt;
* Add a button to delete the local file and return to the inherited statement&lt;br /&gt;
* Only copy the picture used in the CSS files (by listing them in the manifest as file to copy)&lt;br /&gt;
* Remind which template the current one extends (if any)&lt;br /&gt;
&lt;br /&gt;
==Template options==&lt;br /&gt;
Another novelty of LS3 is the template option page. As we’ll see later, template creators can create their own options and even their own admin option page. Here, we’ll quickly see how the option page of the Core Templates work. To access the template options at global level: click on “template options” in the template list&lt;br /&gt;
====Advanced options====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{QS:Theme editor - advanced options}}&lt;br /&gt;
&lt;br /&gt;
====Simple options====&lt;br /&gt;
&lt;br /&gt;
The Simple option page comes from the Template itself. It’s made via a twig file and some javascript inside the template/options/ directory:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/tree/develop/templates/default/options&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] This page can be completely different from a template to another, and template providers are strongly encouraged to create their own look &amp;amp; feel. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Options.png|thumb|750px|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The simple option page simply fills in the advanced form inputs. You can see it by turning on or off a setting in the simple page, and see how the related input in the advanced form is modified accordingly. For example, in Default Template’s simple options,, if you change the Bootswatch theme to “Darkly” and then click on the tab for advanced options (even without saving)  you’ll see that the field “Cssframework Css” changed from&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#123;&amp;quot;replace&amp;quot;: &amp;amp;#91;&amp;amp;#91;&amp;quot;css/bootstrap.css&amp;quot;,&amp;quot;css/flatly.css&amp;quot;]]}&amp;lt;br&amp;gt;&lt;br /&gt;
to&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;#123;&amp;quot;replace&amp;quot;: &amp;amp;#91;&amp;amp;#91;&amp;quot;css/bootstrap.css&amp;quot;,&amp;quot;css/darkly.css&amp;quot;]]}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here are the different simple options for the Core templates:&lt;br /&gt;
*&#039;&#039;&#039;Ajax mode:&#039;&#039;&#039; Should the next page be loaded via ajax (faster) or via page reload (better for debugging purpose)&lt;br /&gt;
*&#039;&#039;&#039;Background image:&#039;&#039;&#039; if set to Yes, the image called pattern.png will be loaded (will be replaced by a file selector in Master)&lt;br /&gt;
*&#039;&#039;&#039;Box container:&#039;&#039;&#039; if set to No, the questions will not be contained in a box (so you can use large arrays bigger than the screen width)&lt;br /&gt;
*&#039;&#039;&#039;Brandlogo:&#039;&#039;&#039; if set to no, the name of the survey will be shown in top bar, else, you can select one of the pictures inside the file directory to be used as logo picture.&lt;br /&gt;
*&#039;&#039;&#039;Animate body:&#039;&#039;&#039; if set to yes, you can choose one of the animations to apply when the body of the survey is loaded&lt;br /&gt;
*&#039;&#039;&#039;Animate question:&#039;&#039;&#039; same with questions&lt;br /&gt;
*&#039;&#039;&#039;Animate alerts:&#039;&#039;&#039; same with alerts&lt;br /&gt;
*&#039;&#039;&#039;Bootstrap theme:&#039;&#039;&#039; here, you can choose a Bootstrap theme to load. They come from Bootswatch https://bootswatch.com/3/&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The library used for animations is animate.css: https://daneden.github.io/animate.css/&lt;br /&gt;
Of course, a template provider could add his own animation library or no animation library at all.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] The monochrome templates use the same bootstrap color theme as the admin user interface. They’re not using the css framework replacement system, but simply add a CSS file. So, it illustrates another way to deal with custom themes for template providers.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Inheritance system====&lt;br /&gt;
&lt;br /&gt;
In the previous part, we’ve seen that a template can extend another template. A template configuration can also inherit from another template configuration. It means that for a given template, you can have a configuration at &lt;br /&gt;
&lt;br /&gt;
* global level (the one we’ve just seen accessible from the template list)&lt;br /&gt;
* at survey group level&lt;br /&gt;
* a last one at survey level. &lt;br /&gt;
&lt;br /&gt;
Each parameter at a certain level can inherit from the upper level: survey group inheritance. First, let’s see the survey group level.&lt;br /&gt;
&lt;br /&gt;
======At survey group level======&lt;br /&gt;
&lt;br /&gt;
Indeed, one of the other great novelties of LS3 is the survey group system. You can now create different groups to organize your surveys. To access it, go to the survey list and then click on the survey group tab:&lt;br /&gt;
[[File:Surveygroup.png|thumb|800px|center|&#039;&#039;The survey groups tab&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
In this list, you have two action buttons. If the group is empty, you can delete it. Else, you can always edit it. By clicking on the edit button, you reach the Survey Group configuration page:&lt;br /&gt;
[[File:Surveygroupedit.png|thumb|800px|center|&#039;&#039;Editing Default Survey Group&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The third tab of this page is called “Template options for this survey group”. If you click on it, you’ll see the same list of templates than in the template list, except that here only the option button is visible (template editor can be reached only from the main list).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Now, if you click on the option for Default Template, you’ll see this:&lt;br /&gt;
[[File:Option group inherit.png|thumb|800px|center|&#039;&#039;At Survey Group, Template Options are inherited by default&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Inherit everything&#039;&#039;&#039; means that all the configuration will be inherited from the Global configuration level. &lt;br /&gt;
* If you go to the &#039;&#039;&#039;advanced options page&#039;&#039;&#039;, you’ll see that all the fields are set to inherit.&lt;br /&gt;
* If you click on &amp;quot;no&amp;quot; for &amp;quot;Inherit everything&amp;quot;  in the simple options, you’ll again see a very similar page to the global option page. The only difference is that for each field, you can set it to yes, no, or inherit; and each dropdown selector has an &#039;&#039;inherit&#039;&#039;&#039; value.  &lt;br /&gt;
[[File:Inherit group.png|thumb|800px|center|&#039;&#039;Each setting can have a inherited value&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] A survey group can be a child of another group. In this case, it will inherit from its parent.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======At survey level======&lt;br /&gt;
When editing a survey, in the left bar menu, you’ll see a new entry “Template Options”. It will lead you to the option page of the Template selected for the current survey. You’ll find the same inheritance system as in the survey group, but this time, inherit means that the setting will be inherited from the Survey Group of the survey.  &lt;br /&gt;
[[File:Options survey.png|thumb|800px|center|&#039;&#039;Template Options at Survey Level&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
==Use case example==&lt;br /&gt;
Let’s say you’re using a single template for different companies (A and B). You set your favorites options at global level (e.g.: ajax on, animate body with a slide in, alerts with a pulse). Then you create a survey group for each company: a survey group for company A that will host all the surveys for this company, and a survey for company B that will host all the surveys for company B. At this level, you’ll set the logo and the background only, and you will let the other options to inherit. So, all the surveys in group A will use the logo from the company A, and all the survey from group B the logo from company B. For one of the surveys of company A, you could use a different background in relation with the topic of the survey: you just change the background in options at survey level. If someone in company B tells you that the pulsing alert is too aggressive and he would prefer something smoother like a fade in, you just change the alert animation at the Survey Group B level and all the surveys of this group will now use this animation. If the company A changes its logo, you can change it at the level of Survey Group A, and all the surveys of this group will use the new logo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Those examples are based on the current options of the core template. But of course, if you are a template provider, or if you’re able to script a bit with twig, you can add your own options. For example, you could add an option “info footer” where you could add data like the company website or a phone number for help. Then, if company A has different departments, with different phone numbers, you can just create one sub-group for each department in Survey Group A. Each subgroup will have its own phone number in these options.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= FAQ about theme customization =&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find here some answers to questions that have been asked in the forum and that could help you to customize your theme.&lt;br /&gt;
&lt;br /&gt;
==Customizing CSS: deal with the asset manager (&amp;quot;why my changes are not applied?&amp;quot;) ==&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;re trying to update the CSS of a theme by directly editing the code with your favorite editor, you could be surprised that your changes are not applied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since 2.50, LS use the Yii asset manager:&lt;br /&gt;
[http://www.yiiframework.com/wiki/148/understanding-assets/  Yii Documentation about Assets]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It moves the CSS files of a theme to a tmp/ sub-directory with a random string (eg: &amp;quot;tmp/1ef64ml/&amp;quot;). So if you make any change to a css file, and tell it to the asset manager, the files are copied to a new sub-directory with a new name so the user browser&#039;s cache is updated and they see the new css. Else, they would have to clean their browser cache. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the CSS links in header when asset manager is on:&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Assets on vanilla.jpg]]&lt;br /&gt;
&amp;lt;br /&amp;gt;As you can see they all refer to the tmp/ subfolders. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the CSS links in header when asset manager is off:&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Asset off.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;As you can see they point to the real files of the theme. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] Of course, if the Asset Manager doesn&#039;t know you changed the file, the old file from the old tmp/directory remain unchanged, and your changes will never be applied..&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, when you&#039;re editing CSS of a theme you have various possibilities:&lt;br /&gt;
*&#039;&#039;&#039;You can use the the LS Theme Editor:&#039;&#039;&#039; it deals with the asset manager and you don&#039;t have to worry about anything&lt;br /&gt;
*&#039;&#039;&#039;You can turn debug mode on:&#039;&#039;&#039; it will turn asset manager off, so the real css/js files of your themes are called (but then, you have to refresh your browser cache at each load)&lt;br /&gt;
* &#039;&#039;&#039;You can refresh the  assets cache&#039;&#039;&#039;: from Global Settings -&amp;gt; General -&amp;gt; Clear asset cache&lt;br /&gt;
&lt;br /&gt;
[[File:Clearassets-ls3 3.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] &#039;&#039;&#039;Using the theme editor to edit the custom CSS is by far the best solution.&#039;&#039;&#039; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the theme editor will help you to understand the architecture of the new theme engine.&lt;br /&gt;
Also, if your customizing fruity, be careful with CSS specifity: most of the definitions use the selector &amp;quot;.fruity&amp;quot; (one of the class of the body element)&lt;br /&gt;
&lt;br /&gt;
== Adding custom fonts to my theme ==&lt;br /&gt;
=== The easy way: using Google Font CDN  ===&lt;br /&gt;
Bootswatch Survey Theme uses Google Font CDN. Let&#039;s have a look to how ti works:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/bootswatch/css/variations/flatly.min.css&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
@import url(&amp;quot;https://fonts.googleapis.com/css?family=Lato:400,700,400italic&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Lato font is used via CSS rules:&lt;br /&gt;
https://github.com/thomaspark/bootswatch/blob/master/dist/flatly/bootstrap.css#L72&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
body {&lt;br /&gt;
  ...&lt;br /&gt;
 font-family: &amp;quot;Lato&amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use any google font that way in your custom theme. Of course, you should remove the font selector from the options of your theme. Delete those lines in options.twig:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/options/options.twig#L209-L230&lt;br /&gt;
&lt;br /&gt;
=== Using local font  ===&lt;br /&gt;
Of course, you can also download the font files and use them from local server rather than from Google CDN (better for privacy). To have an example of how to it, here our local version of noto font:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/assets/fonts/noto.css&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
  font-family: &#039;Noto Sans&#039;;&lt;br /&gt;
  font-weight: 300;&lt;br /&gt;
  font-style: normal;&lt;br /&gt;
  src: url(&#039;./font-src/Noto/NotoSans-Regular.ttf&#039;);&lt;br /&gt;
}&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use a very similar definition in your theme css file, and then by copying the file NotoSans-Regular.ttf  in your theme css/font-src/ folder. &lt;br /&gt;
&lt;br /&gt;
Then, apply that font to your body (or any other element) like above, and remove the default option font selector.&lt;br /&gt;
&lt;br /&gt;
=== Creating your own font selector in options  ===&lt;br /&gt;
For now, you can&#039;t easily use the core font selector to add your own font in options. We need first to give the possibility to end user to upload custom packages (see next paragraph: A look into the Fruity Font Selector ) &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here how to proceed:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*Add two fonts (my_custom_font and my_custom_other_font) into your theme, using CDN or local server &lt;br /&gt;
*Then, in your css file, add two new classes:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.font-my_custom_font {&lt;br /&gt;
 font-family: &#039;my_custom_font &#039;;&lt;br /&gt;
}&lt;br /&gt;
.font-my_custom_other_font {&lt;br /&gt;
 font-family: &#039;my_custom_other_font&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*In the XML file of your theme, add a font option (default one will be my_custom_font) :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;options&amp;gt;&lt;br /&gt;
        ....&lt;br /&gt;
        &amp;lt;font&amp;gt;my_custom_font&amp;lt;/font&amp;gt;&lt;br /&gt;
    &amp;lt;/options&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* in option.twig, add you font picker adding those lines (untested for now, so come complain to the forum if it doesn&#039;t work):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
            &lt;br /&gt;
            &amp;lt;div class=&#039;row ls-space margin top-15 bottom-15 action_hide_on_inherit&#039;&amp;gt;&lt;br /&gt;
                &amp;lt;hr/&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&#039;row action_hide_on_inherit&#039;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&#039;panel panel-default&#039;&amp;gt;&lt;br /&gt;
                        &amp;lt;div class=&#039;panel-heading&#039;&amp;gt;{{ &amp;quot;My custom fonts&amp;quot; | t }}&amp;lt;/div&amp;gt;&lt;br /&gt;
                        &amp;lt;div class=&#039;panel-body&#039;&amp;gt;&lt;br /&gt;
                            &amp;lt;div class=&#039;form-group row&#039;&amp;gt;&lt;br /&gt;
                                &amp;lt;label for=&#039;simple_edit_font&#039; class=&#039;control-label&#039;&amp;gt;{{ &amp;quot;Select font:&amp;quot; | t }}&amp;lt;/label&amp;gt;&lt;br /&gt;
                                &amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
                                    &amp;lt;select class=&#039;form-control selector_option_value_field&#039; id=&#039;simple_edit_font&#039; name=&#039;font&#039;&amp;gt;&lt;br /&gt;
                                    {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}&lt;br /&gt;
                                        {% set fontOptions = fontOptions ~ &#039;&amp;lt;option value = &amp;quot;inherit&amp;quot; &amp;gt; Inherit&amp;lt;/option&amp;gt;&#039; %}&lt;br /&gt;
                                    {% endif %}&lt;br /&gt;
                                   &amp;lt;optgroup  label=&amp;quot;{{ &amp;quot;My Custom fonts&amp;quot; | t }}&amp;quot;&amp;gt;&lt;br /&gt;
                                   &amp;lt;option class=&amp;quot;font-my_custom_font&amp;quot;     value=&amp;quot;custom_font&amp;quot;   data-font-package=&amp;quot;&amp;quot;  &amp;gt;Custom&amp;lt;/option&amp;gt;&lt;br /&gt;
                                  &amp;lt;option class=&amp;quot;font-my_custom_other_font&amp;quot; value=&amp;quot;my_custom_other_font&amp;quot; data-font-package=&amp;quot;&amp;quot;  &amp;gt;Other&amp;lt;/option&amp;gt;&lt;br /&gt;
                                  &amp;lt;/optgroup&amp;gt;&lt;br /&gt;
                                   &lt;br /&gt;
                                    &amp;lt;/select&amp;gt;&lt;br /&gt;
                                &amp;lt;/div&amp;gt;&lt;br /&gt;
                            &amp;lt;/div&amp;gt;&lt;br /&gt;
                        &amp;lt;/div&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Now your users should be able to choose between those two fonts.&lt;br /&gt;
&lt;br /&gt;
=== A look into the Fruity Font Selector ===&lt;br /&gt;
In the future, we&#039;ll give the possibility to final user to upload their own asset packages, including font packages. It will make very easy any customization of fonts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To understand Yii Packages:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.yiiframework.com/doc/api/1.1/CClientScript#packages-detail&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
LimeSurvey packages are defined in different files. Fonts packages are defined here:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/4c40b61afb0dba8fd80154b50f5831045df8d814/application/config/fonts.php&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For example, the Noto font package is defined here:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/4c40b61afb0dba8fd80154b50f5831045df8d814/application/config/fonts.php#L47-L53&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &#039;font-noto&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;devBaseUrl&#039; =&amp;gt; &#039;assets/fonts/&#039;,&lt;br /&gt;
        &#039;basePath&#039; =&amp;gt; &#039;fonts&#039;,&lt;br /&gt;
        &#039;css&#039; =&amp;gt; array(&lt;br /&gt;
            &#039;noto.css&#039;,&lt;br /&gt;
        ),&lt;br /&gt;
    ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The noto.css file it contains is here:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/4c40b61afb0dba8fd80154b50f5831045df8d814/assets/fonts/noto.css&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Notice the definition of the css class &amp;quot;.font-noto&amp;quot; at the end of it:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
  font-family: &#039;Noto Sans&#039;;&lt;br /&gt;
  ...&lt;br /&gt;
}&lt;br /&gt;
...&lt;br /&gt;
.font-noto{&lt;br /&gt;
    font-family: &#039;Noto Sans&#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, in Vanilla Theme, noto font is used by adding the noto package and defining the font option to noto:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/config.xml#L79&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;packages&amp;gt;&lt;br /&gt;
             ....&lt;br /&gt;
            &amp;lt;add&amp;gt;font-noto&amp;lt;/add&amp;gt;&lt;br /&gt;
        &amp;lt;/packages&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight &amp;gt;&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/config.xml#L58&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;options&amp;gt;&lt;br /&gt;
        ....&lt;br /&gt;
        &amp;lt;font&amp;gt;noto&amp;lt;/font&amp;gt;&lt;br /&gt;
    &amp;lt;/options&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, the body class font is defined using this value:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/views/layout_global.twig#L76&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;body class=&amp;quot; ...  font-{{  aSurveyInfo.options.font }} ... &amp;quot; ... &amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, the XML file only contains the default values for your template configuration. But indeed, those values are defined and read inside the database (table &amp;quot;template_configuration&amp;quot;) as json strings. The option.js file just use the value of the font selector of the simple option to change the value inside the advanced tab form:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/options/options.js#L148-L174&lt;br /&gt;
&lt;br /&gt;
So when the &amp;quot;upload asset package&amp;quot; functionality will be available, it will be easy to add a script that scan all the existing font packages to add them in the selector.&lt;br /&gt;
&lt;br /&gt;
== Adding theme options to control positioning and display of survey elements  ==&lt;br /&gt;
This tutorial will show how to add options to an extended theme to display survey elements in various locations. In this case, we will create theme options to show the survey title in two different locations.&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] For the sake of simplicity, we will base the tutorial on an extension of the &amp;quot;bootswatch&amp;quot; theme in LimeSurvey version 3.4.3.&amp;lt;/div&amp;gt;  &lt;br /&gt;
=== Create a custom theme  ===&lt;br /&gt;
#Extend the &amp;quot;bootswatch&amp;quot; theme as described above.&lt;br /&gt;
#Copy &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;custom.css&amp;lt;/span&amp;gt; to the local template as described above.&lt;br /&gt;
===Create new template options===&lt;br /&gt;
#Copy the contents of &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/bootswatch/options/&amp;lt;/span&amp;gt; to &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/options/&amp;lt;/span&amp;gt;.&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/options/options.twig&amp;lt;/span&amp;gt; in an editor and find &amp;quot;{# Bootstrap Bootswatch theme #}&amp;quot;. Directly before its parent  &amp;lt;nowiki&amp;gt;&amp;lt;div class=&#039;row&#039;&amp;gt;&amp;lt;/nowiki&amp;gt; element, add this:&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
		{# Custom survey name in navbar #}&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;div class=&#039;col-sm-12 col-md-6&#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;div class=&#039;form-group row&#039;&amp;gt;&lt;br /&gt;
					&amp;lt;label for=&#039;simple_edit_options_surveyname1&#039; class=&#039;control-label&#039;&amp;gt;Survey name in navbar&amp;lt;/label&amp;gt;&lt;br /&gt;
					&amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
						&amp;lt;div class=&amp;quot;btn-group&amp;quot; data-toggle=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname1&#039; type=&#039;radio&#039; value=&#039;on&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname1&#039;/&amp;gt;&lt;br /&gt;
								Yes&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname1&#039; type=&#039;radio&#039; value=&#039;off&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname1&#039;/&amp;gt;&lt;br /&gt;
								No&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
						&amp;lt;/div&amp;gt;&lt;br /&gt;
					&amp;lt;/div&amp;gt;&lt;br /&gt;
				&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;hr/&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		{# Custom survey name below progress bar #}&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;div class=&#039;col-sm-12 col-md-6&#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;div class=&#039;form-group row&#039;&amp;gt;&lt;br /&gt;
					&amp;lt;label for=&#039;simple_edit_options_surveyname2&#039; class=&#039;control-label&#039;&amp;gt;Survey name below progress bar&amp;lt;/label&amp;gt;&lt;br /&gt;
					&amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
						&amp;lt;div class=&amp;quot;btn-group&amp;quot; data-toggle=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname2&#039; type=&#039;radio&#039; value=&#039;on&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname2&#039;/&amp;gt;&lt;br /&gt;
								Yes&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname2&#039; type=&#039;radio&#039; value=&#039;off&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname2&#039;/&amp;gt;&lt;br /&gt;
								No&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
						&amp;lt;/div&amp;gt;&lt;br /&gt;
					&amp;lt;/div&amp;gt;&lt;br /&gt;
				&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;hr/&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/config.xml&amp;lt;/span&amp;gt; and add two items to the &amp;quot;options&amp;quot; block so it looks like this:&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;    &amp;lt;options&amp;gt;&lt;br /&gt;
        &amp;lt;ajaxmode&amp;gt;on&amp;lt;/ajaxmode&amp;gt;&lt;br /&gt;
        &amp;lt;brandlogo&amp;gt;on&amp;lt;/brandlogo&amp;gt;&lt;br /&gt;
        &amp;lt;brandlogofile&amp;gt;./files/logo.png&amp;lt;/brandlogofile&amp;gt;&lt;br /&gt;
        &amp;lt;container&amp;gt;on&amp;lt;/container&amp;gt;&lt;br /&gt;
        &amp;lt;surveyname1&amp;gt;on&amp;lt;/surveyname1&amp;gt;&lt;br /&gt;
        &amp;lt;surveyname2&amp;gt;on&amp;lt;/surveyname2&amp;gt;&lt;br /&gt;
    &amp;lt;/options&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#This should give you two new options in the Theme Options screen like this:&amp;lt;br /&amp;gt;[[File:Tutorial_tp_1_1.png]]&lt;br /&gt;
===Modifed view for Survey Title in the navbar===&lt;br /&gt;
#Create a new directory &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/views/subviews/header/&amp;lt;/span&amp;gt;.&lt;br /&gt;
#Copy &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/header/nav_bar.twig&amp;lt;/span&amp;gt; to that new directory.&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/header/nav_bar.twig&amp;lt;/span&amp;gt; and find &amp;quot;{# Logo option #}&amp;quot;. Under that, modify the IF statement for the logo/survey-name, so it looks like this:&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
		{# Logo option #}&lt;br /&gt;
        {% if( aSurveyInfo.options.brandlogo == &amp;quot;on&amp;quot;) %}&lt;br /&gt;
            &amp;lt;div class=&amp;quot;{{ aSurveyInfo.class.navbarbrand }} logo-container&amp;quot;  {{ aSurveyInfo.attr.navbarbrand }}  &amp;gt;&lt;br /&gt;
                {{ image(aSurveyInfo.options.brandlogofile, aSurveyInfo.name, {&amp;quot;class&amp;quot;: &amp;quot;logo img-responsive&amp;quot;}) }}&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        {% endif %}&lt;br /&gt;
        {% if( aSurveyInfo.options.surveyname1 == &amp;quot;on&amp;quot;) %}&lt;br /&gt;
            &amp;lt;div class=&amp;quot;{{ aSurveyInfo.class.navbarbrand }}&amp;quot;  {{ aSurveyInfo.attr.navbarbrand }} &amp;gt;&lt;br /&gt;
                {{ aSurveyInfo.name }}&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        {% endif %}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add something like this to &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/css/custom.css&amp;lt;/span&amp;gt;:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.navbar-brand {&lt;br /&gt;
    line-height: 60px;&lt;br /&gt;
    font-size: 32px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Toggle the &amp;quot;Survey name in navbar&amp;quot; theme option to &amp;quot;Yes&amp;quot;&lt;br /&gt;
#You should see this:&amp;lt;br /&amp;gt;[[File:Tutorial_tp_1_2.png]]&lt;br /&gt;
===Modifed view for Survey Title under progress bar===&lt;br /&gt;
#Create a new directory &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/views/subviews/survey/group_subviews&amp;lt;/span&amp;gt;.&lt;br /&gt;
#Copy &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/survey/group_subviews/group_container.twig&amp;lt;/span&amp;gt; to that new directory.&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/survey/group_subviews/group_container.twig&amp;lt;/span&amp;gt; and add an &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;/nowiki&amp;gt; element for the survey name. So it looks like this:&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;{{ aSurveyInfo.class.groupcontainer }} space-col&amp;quot; {{ aSurveyInfo.attr.groupcontainer }}&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    {# Custom survey name #}&lt;br /&gt;
    {% if( aSurveyInfo.options.surveyname2 == &amp;quot;on&amp;quot;) %}&lt;br /&gt;
    	&amp;lt;h1 class=&amp;quot;custom-survey-name&amp;quot;&amp;gt;{{ aSurveyInfo.name }}&amp;lt;/h1&amp;gt;&lt;br /&gt;
    {% endif %}&lt;br /&gt;
 &lt;br /&gt;
    {# Group Name #}&lt;br /&gt;
    {{ include(&#039;./subviews/survey/group_subviews/group_name.twig&#039;) }}&lt;br /&gt;
 &lt;br /&gt;
    {# Group Description #}&lt;br /&gt;
    {{ include(&#039;./subviews/survey/group_subviews/group_desc.twig&#039;) }}&lt;br /&gt;
 &lt;br /&gt;
    {#&lt;br /&gt;
        PRESENT THE QUESTIONS&lt;br /&gt;
 &lt;br /&gt;
        This is the main part. It will render each question for this group&lt;br /&gt;
     #}&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;!-- PRESENT THE QUESTIONS --&amp;gt;&lt;br /&gt;
    {% for  aQuestion in aGroup.aQuestions %}&lt;br /&gt;
         {{ include(&#039;./subviews/survey/question_container.twig&#039;) }}&lt;br /&gt;
    {% endfor %}&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;!-- Hidden inputs --&amp;gt;&lt;br /&gt;
    {% if aGroup.show_last_group == true %}&lt;br /&gt;
        &amp;lt;input type=&#039;hidden&#039; name=&#039;lastgroup&#039; value=&#039;{{ aGroup.lastgroup }}&#039; id=&#039;lastgroup&#039; /&amp;gt;&lt;br /&gt;
    {% endif %}&lt;br /&gt;
 &lt;br /&gt;
    {% if aGroup.show_last_answer == true %}&lt;br /&gt;
        &amp;lt;input type=&#039;hidden&#039; name=&#039;lastanswer&#039; value=&#039;{{ aGroup.lastanswer }}&#039; id=&#039;lastanswer&#039; /&amp;gt;&lt;br /&gt;
    {% endif %}&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Add something like this to &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/css/custom.css&amp;lt;/span&amp;gt;:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.navbar-brand {&lt;br /&gt;
    line-height: 60ph1.custom-survey-name {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Toggle the &amp;quot;Survey name below progress bar&amp;quot; theme option to &amp;quot;Yes&amp;quot;&lt;br /&gt;
#You should see this:&amp;lt;br /&amp;gt;[[File:Tutorial_tp_1_3.png]]&lt;br /&gt;
&lt;br /&gt;
===Downloads===&lt;br /&gt;
* Sample extended theme: [[Media:Test_survey_names.zip]]&lt;br /&gt;
&lt;br /&gt;
=Creating a template from scratch=&lt;br /&gt;
Documentation coming soon...&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;:  if you edit the XML file of a theme, you must uninstall and reinstall the theme so it&#039;s taken into account. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;:  to avoid that, you can force the use to the XML rather than DB. In config.php turn debug mode on and uncommment:&lt;br /&gt;
&lt;br /&gt;
&#039;force_xmlsettings_for_survey_rendering&#039; =&amp;gt; true, // Uncomment if you want to force the use of the XML file rather than DB (for easy theme development) &lt;br /&gt;
&lt;br /&gt;
Becareful: everything will be loaded from the XML (included options, etc)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;:  if you manually edit the CSS/JS files (without using the Teeme Editor), and if debug mode is off, you can now force the asset to be flushed. In &amp;quot;Global Settings&amp;quot;, &amp;quot;General tab&amp;quot;, click the button &amp;quot;Clear assets cache:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=New_Template_System_in_LS3.x&amp;diff=90215</id>
		<title>New Template System in LS3.x</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=New_Template_System_in_LS3.x&amp;diff=90215"/>
		<updated>2018-03-05T23:29:36Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
On this page you&#039;ll learn how to:&lt;br /&gt;
&lt;br /&gt;
* Use the new template system of LimeSurvey 3.0.&lt;br /&gt;
* Use inheritance to manage your own templates.&lt;br /&gt;
* Add a picture to your template&lt;br /&gt;
* Manage template options for your surveys and survey groups&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LimeSurvey 3 introduces a complete new template engine system, based on Twig 1.29, Bootstrap, and allowing template inheritance and template options.  It completely removes the old replacement keywords system. So now, 100% of the frontend HTML can be customized. For example, in the old template system, there was a keyword {ASSESSMENTS} that was replaced by the assessment HTML at execution time. A template designer had no way to customize this HTML (other than using JavaScript). Now, there is a file called assessments.twig that contains the logic (written in Twig) to generate this HTML. In these pages, we will give you some explanation about how to use this new template engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]]  We will not detail here how Twig works. It’s kind of very simplified PHP that offers a high level of security thanks to the “sandbox” system (we’ll see that in more detail in the part about the Template Engine Core code). If you already know PHP, it will be extremely easy for you to master. If you don’t know PHP, it still should be pretty easy to learn. Please, have a look to the Twig 1.X documentation:&lt;br /&gt;
https://twig.symfony.com/ &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Editing Using the Admin Interface=&lt;br /&gt;
==Template list==&lt;br /&gt;
On the admin dashboard, there is now a box to access the template list:&lt;br /&gt;
[[File:Template list.jpg|thumb|800px|center|baseline|border|&#039;&#039;The template list after a fresh install of RC3&#039;&#039;]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The list is divided in 5 columns:&lt;br /&gt;
* a preview of the template: it’s just a picture file called “preview.png” at the root of the template&lt;br /&gt;
* the “name” of the template: the directory name of the template. Before we release the LS3 master, it will become the template “Title” (can be different from directory name, and it can contain special cgunnarhars)&lt;br /&gt;
* the description of the template: a string set in its manifest&lt;br /&gt;
* the type of template: Core template (provided with LimeSurvey), User template (added in upload directory), XML template (not loaded in database)&lt;br /&gt;
* Extends: if the template extends another template, its name will be indicated here&lt;br /&gt;
* Some action buttons:&lt;br /&gt;
** Install: it will load the manifest of a template to add it to database and make it available for selection at the survey level&lt;br /&gt;
** Uninstall: it will delete the configuration entries of a template in the database&lt;br /&gt;
** Template editor: it will redirect you to the template editor&lt;br /&gt;
** Template option: it will lead you the global configuration of template options&lt;br /&gt;
&lt;br /&gt;
==Template Editor==&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] This documentation supposes you already know how to use the Template Editor in the previous version of LS. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The Template Editor has been kept as close as possible to the original one. So, when you open a Core Template, you can’t edit it. But now, instead of a “copy” button, you have an “extend button”.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Extends default.png|center|baseline|border|&#039;&#039;Now you &#039;&#039;&#039;extend&#039;&#039;&#039; template&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
====A quick overview of the concept of template inheritance====&lt;br /&gt;
&lt;br /&gt;
In LS3, a template can now inherit from another template, it can “extend” another template. This means that the template directory will be practically empty, it will only contain the files (views, style sheets, scripts, resources etc.) that differ from the original ones. Doing so, it will be easy for you to create a fleet of templates for your different users without having to maintain a lot of different templates. For example: you can have your own home-made template, and then a version for a company (with its logo, its style, maybe a link to its website on the footer etc.), another version for another company etc. If then you update the CSS or the global layout of your custom template, all the templates that inherit from it will be updated automatically. Note that the inheritance is recursive: a template can extend a template that extends another one etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] It also means that if you extend one of the core templates of LimeSurvey, you will still benefit from its updates.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Novelties in the user interface====&lt;br /&gt;
&lt;br /&gt;
To extend the Monochrome template of LimeSurvey, go to the Template list, click on the button “Template Editor” of the Monochrome template. Then, click on “extend” and validate the new name “extends_monochrome”.&lt;br /&gt;
&lt;br /&gt;
If you now go to the upload directory (with your file/ftp client), you’ll see that a new directory has been created: &#039;&#039;&#039;upload/templates/extends_monochrome&#039;&#039;&#039;&lt;br /&gt;
It contains an XML file and directories, but most directories are empty. It has neither views nor CSS nor JS. But, you can still select this template as a normal one from a survey and it will look exactly like the monochrome template.&lt;br /&gt;
&lt;br /&gt;
[[File:Extends monochrome empty.jpg|center|baseline|border|&#039;&#039;The template tree (directory and files) just after its creation. It&#039;s practically empty&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] The ressources (jpg, png etc.) from the original template are copied when extending a template. This is because if you copy a CSS file from the original template locally, and if it refers to those files (like in background-image statement), it will need to find those pictures in the current template path. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The template editor for the extends_monochrome template looks like that:&lt;br /&gt;
[[File:Editing extends monochrome.jpg|center|baseline|border|&#039;&#039; Editing extends_monochrome template&#039;&#039;]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
There is no big difference with the old template editor. Let’s list the main ones:&lt;br /&gt;
 &amp;lt;br /&amp;gt;&lt;br /&gt;
* The keyword &#039;&#039;&#039;inherited&#039;&#039;&#039; on the file list. It means that the file is not present in the template directory and that the file from the original template will be used.&lt;br /&gt;
[[File:Inherited.jpg|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*  The main editor ( [https://ace.c9.io ACE editor ] ) shows the content of the selected file. The files not only contain HTML, CSS or JS, but also Twig statements. Those Twig statements give us the possibility to push some logic to template views that were located deep in the core before, and that now can be customized.&lt;br /&gt;
[[File:Twig code in editor.jpg|center|&#039;&#039;Some twig code, for Survey List&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* This is why you have more screen types available in the dropdown selector of the top menu now. You’ll notice pages such as ‘Survey List’, ‘Load’, ‘Save’, ‘Error’, ‘Registration’, ‘Assessments’, ‘Print Answers’ that weren’t available before, or that you couldn’t really be customized before.&lt;br /&gt;
[[File:Newscreens editables.jpg|195px|center|&#039;&#039;Now, you can customize all screens&#039;&#039;]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
* The ‘tip’ link at the bottom of the file list gives you the Twig way to add a picture in your HTML&lt;br /&gt;
[[File:Tip picture.png|605px|center]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
* The button ‘save changes’ becomes a button &#039;&#039;&#039;Copy to local template and save changes&#039;&#039;&#039;&lt;br /&gt;
[[File:Copytolocal.png|360px|center]]&lt;br /&gt;
&lt;br /&gt;
====Quick example: adding a picture ====&lt;br /&gt;
&lt;br /&gt;
The button &#039;&#039;&#039;Copy to local template and save changes&#039;&#039;&#039; will do exactly what it says: if you edit anything inside the file and then click on that button, it will copy the file to the template you’re editing, and save your changes.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For example: click on the file layout_global.twig, then just before the block content ( {% block content %}) add the text “TEST” and click the button. You can see that the label of the file changed from “inherited” to “local” and now the button is a simple button &#039;&#039;&#039;save changes&#039;&#039;&#039;. &lt;br /&gt;
[[File:After edition.png|center|&#039;&#039;just after clicking on the button &#039;&#039;&#039; Copy to local template and save changes &#039;&#039;&#039;&#039;|]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If you open a file explorer and go to the directory upload/templates/extends_monochrome/views/, you will see that it contains only one file, the file layout_global.twig and that the string “TEST” is there.&lt;br /&gt;
[[File:Tree with layout global arrow.png|center|&#039;&#039;Now the file is present in your template&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now instead of addind a random text, we will add a picture.  If you click on the tip link, it will tell you:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To use a picture in a .twig file:&lt;br /&gt;
&#039;&#039;&#039;{{ image(&#039;./files/myfile.png&#039;, &#039;alt-text for my file&#039;, {&amp;quot;class&amp;quot;: &amp;quot;myclass&amp;quot;}) }}&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If you have read the Twig documentation (and you should have done so at this point), you know that &#039;&#039;&#039;&amp;amp;#123;&amp;amp;#123; function( ) }}&amp;lt;nowiki /&amp;gt;&#039;&#039;&#039; will echo the result of a function on screen. Here, the function is image( ). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]]  If you’re curious to know what it does, you can find it in the code here (version of RC3): [https://github.com/LimeSurvey/LimeSurvey/blob/f3737a75e428f604d68d2e5ba958f3eba3eba2e1/application/core/LS_Twig_Extension.php#L219-L237 image() function in RC3]&lt;br /&gt;
If you don’t understand the code: don’t worry, you don’t need to know how it works, but why to use it and how to use it.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
You should use the function image() for two reasons:&lt;br /&gt;
* The function image loops through the template to find the image. If the template you’re working on is extended to another template, and if you copy the file to where you inserted the picture locally, but that picture is not copied in the local template, it will loop through the template inheritance tree to find where that picture is.&lt;br /&gt;
* It will use the asset manager, so it will improve the performance of your template. See the Yii Asset Manager documentation for more information about it: http://www.yiiframework.com/wiki/148/understanding-assets/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&lt;br /&gt;
So, to add a picture to your template:&lt;br /&gt;
* just upload it as usual with the file uploader on the right and then add it to where you want it in any twig file:&lt;br /&gt;
&#039;&#039;&#039;&amp;amp;#123;&amp;amp;#123; image(&#039;./files/myfile.png&#039;) }}&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* If you want to add an alternate text for your picture (for screen readers and HTML validation), add:&lt;br /&gt;
&amp;amp;#123;&amp;amp;#123; image(&#039;./files/myfile.png&#039;), &#039;&#039;&#039; ‘my alternative text’ &#039;&#039;&#039; }}&lt;br /&gt;
&lt;br /&gt;
* If you want to add a class attribute and add an id to it:&lt;br /&gt;
&amp;amp;#123;&amp;amp;#123; image(&#039;./files/myfile.png&#039;), ‘my alternative text’, &#039;&#039;&#039; &amp;amp;#123;“class”: “a_nice_css_class”, “id”: “any_id”} &#039;&#039;&#039; }}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Some things on our TO-DO list====&lt;br /&gt;
* Give users the possibility to upload a custom preview file from the editor itself&lt;br /&gt;
* Add a button to delete the local file and return to the inherited statement&lt;br /&gt;
* Only copy the picture used in the CSS files (by listing them in the manifest as file to copy)&lt;br /&gt;
* Remind which template the current one extends (if any)&lt;br /&gt;
&lt;br /&gt;
==Template options==&lt;br /&gt;
Another novelty of LS3 is the template option page. As we’ll see later, template creators can create their own options and even their own admin option page. Here, we’ll quickly see how the option page of the Core Templates work. To access the template options at global level: click on “template options” in the template list&lt;br /&gt;
====Advanced options====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{QS:Theme editor - advanced options}}&lt;br /&gt;
&lt;br /&gt;
====Simple options====&lt;br /&gt;
&lt;br /&gt;
The Simple option page comes from the Template itself. It’s made via a twig file and some javascript inside the template/options/ directory:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/tree/develop/templates/default/options&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] This page can be completely different from a template to another, and template providers are strongly encouraged to create their own look &amp;amp; feel. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Options.png|thumb|750px|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The simple option page simply fills in the advanced form inputs. You can see it by turning on or off a setting in the simple page, and see how the related input in the advanced form is modified accordingly. For example, in Default Template’s simple options,, if you change the Bootswatch theme to “Darkly” and then click on the tab for advanced options (even without saving)  you’ll see that the field “Cssframework Css” changed from&lt;br /&gt;
&lt;br /&gt;
&amp;amp;#123;&amp;quot;replace&amp;quot;: &amp;amp;#91;&amp;amp;#91;&amp;quot;css/bootstrap.css&amp;quot;,&amp;quot;css/flatly.css&amp;quot;]]}&amp;lt;br&amp;gt;&lt;br /&gt;
to&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;#123;&amp;quot;replace&amp;quot;: &amp;amp;#91;&amp;amp;#91;&amp;quot;css/bootstrap.css&amp;quot;,&amp;quot;css/darkly.css&amp;quot;]]}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here are the different simple options for the Core templates:&lt;br /&gt;
*&#039;&#039;&#039;Ajax mode:&#039;&#039;&#039; Should the next page be loaded via ajax (faster) or via page reload (better for debugging purpose)&lt;br /&gt;
*&#039;&#039;&#039;Background image:&#039;&#039;&#039; if set to Yes, the image called pattern.png will be loaded (will be replaced by a file selector in Master)&lt;br /&gt;
*&#039;&#039;&#039;Box container:&#039;&#039;&#039; if set to No, the questions will not be contained in a box (so you can use large arrays bigger than the screen width)&lt;br /&gt;
*&#039;&#039;&#039;Brandlogo:&#039;&#039;&#039; if set to no, the name of the survey will be shown in top bar, else, you can select one of the pictures inside the file directory to be used as logo picture.&lt;br /&gt;
*&#039;&#039;&#039;Animate body:&#039;&#039;&#039; if set to yes, you can choose one of the animations to apply when the body of the survey is loaded&lt;br /&gt;
*&#039;&#039;&#039;Animate question:&#039;&#039;&#039; same with questions&lt;br /&gt;
*&#039;&#039;&#039;Animate alerts:&#039;&#039;&#039; same with alerts&lt;br /&gt;
*&#039;&#039;&#039;Bootstrap theme:&#039;&#039;&#039; here, you can choose a Bootstrap theme to load. They come from Bootswatch https://bootswatch.com/3/&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The library used for animations is animate.css: https://daneden.github.io/animate.css/&lt;br /&gt;
Of course, a template provider could add his own animation library or no animation library at all.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] The monochrome templates use the same bootstrap color theme as the admin user interface. They’re not using the css framework replacement system, but simply add a CSS file. So, it illustrates another way to deal with custom themes for template providers.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Inheritance system====&lt;br /&gt;
&lt;br /&gt;
In the previous part, we’ve seen that a template can extend another template. A template configuration can also inherit from another template configuration. It means that for a given template, you can have a configuration at &lt;br /&gt;
&lt;br /&gt;
* global level (the one we’ve just seen accessible from the template list)&lt;br /&gt;
* at survey group level&lt;br /&gt;
* a last one at survey level. &lt;br /&gt;
&lt;br /&gt;
Each parameter at a certain level can inherit from the upper level: survey group inheritance. First, let’s see the survey group level.&lt;br /&gt;
&lt;br /&gt;
======At survey group level======&lt;br /&gt;
&lt;br /&gt;
Indeed, one of the other great novelties of LS3 is the survey group system. You can now create different groups to organize your surveys. To access it, go to the survey list and then click on the survey group tab:&lt;br /&gt;
[[File:Surveygroup.png|thumb|800px|center|&#039;&#039;The survey groups tab&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
In this list, you have two action buttons. If the group is empty, you can delete it. Else, you can always edit it. By clicking on the edit button, you reach the Survey Group configuration page:&lt;br /&gt;
[[File:Surveygroupedit.png|thumb|800px|center|&#039;&#039;Editing Default Survey Group&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The third tab of this page is called “Template options for this survey group”. If you click on it, you’ll see the same list of templates than in the template list, except that here only the option button is visible (template editor can be reached only from the main list).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Now, if you click on the option for Default Template, you’ll see this:&lt;br /&gt;
[[File:Option group inherit.png|thumb|800px|center|&#039;&#039;At Survey Group, Template Options are inherited by default&#039;&#039;]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Inherit everything&#039;&#039;&#039; means that all the configuration will be inherited from the Global configuration level. &lt;br /&gt;
* If you go to the &#039;&#039;&#039;advanced options page&#039;&#039;&#039;, you’ll see that all the fields are set to inherit.&lt;br /&gt;
* If you click on &amp;quot;no&amp;quot; for &amp;quot;Inherit everything&amp;quot;  in the simple options, you’ll again see a very similar page to the global option page. The only difference is that for each field, you can set it to yes, no, or inherit; and each dropdown selector has an &#039;&#039;inherit&#039;&#039;&#039; value.  &lt;br /&gt;
[[File:Inherit group.png|thumb|800px|center|&#039;&#039;Each setting can have a inherited value&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] A survey group can be a child of another group. In this case, it will inherit from its parent.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======At survey level======&lt;br /&gt;
When editing a survey, in the left bar menu, you’ll see a new entry “Template Options”. It will lead you to the option page of the Template selected for the current survey. You’ll find the same inheritance system as in the survey group, but this time, inherit means that the setting will be inherited from the Survey Group of the survey.  &lt;br /&gt;
[[File:Options survey.png|thumb|800px|center|&#039;&#039;Template Options at Survey Level&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
==Use case example==&lt;br /&gt;
Let’s say you’re using a single template for different companies (A and B). You set your favorites options at global level (e.g.: ajax on, animate body with a slide in, alerts with a pulse). Then you create a survey group for each company: a survey group for company A that will host all the surveys for this company, and a survey for company B that will host all the surveys for company B. At this level, you’ll set the logo and the background only, and you will let the other options to inherit. So, all the surveys in group A will use the logo from the company A, and all the survey from group B the logo from company B. For one of the surveys of company A, you could use a different background in relation with the topic of the survey: you just change the background in options at survey level. If someone in company B tells you that the pulsing alert is too aggressive and he would prefer something smoother like a fade in, you just change the alert animation at the Survey Group B level and all the surveys of this group will now use this animation. If the company A changes its logo, you can change it at the level of Survey Group A, and all the surveys of this group will use the new logo.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Those examples are based on the current options of the core template. But of course, if you are a template provider, or if you’re able to script a bit with twig, you can add your own options. For example, you could add an option “info footer” where you could add data like the company website or a phone number for help. Then, if company A has different departments, with different phone numbers, you can just create one sub-group for each department in Survey Group A. Each subgroup will have its own phone number in these options.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= FAQ about theme customization =&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find here some answers to questions that have been asked in the forum and that could help you to customize your theme.&lt;br /&gt;
&lt;br /&gt;
==Customizing CSS: deal with the asset manager (&amp;quot;why my changes are not applied?&amp;quot;) ==&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;re trying to update the CSS of a theme by directly editing the code with your favorite editor, you could be surprised that your changes are not applied.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since 2.50, LS use the Yii asset manager:&lt;br /&gt;
[http://www.yiiframework.com/wiki/148/understanding-assets/  Yii Documentation about Assets]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It moves the CSS files of a theme to a tmp/ sub-directory with a random string (eg: &amp;quot;tmp/1ef64ml/&amp;quot;). So if you make any change to a css file, and tell it to the asset manager, the files are copied to a new sub-directory with a new name so the user browser&#039;s cache is updated and they see the new css. Else, they would have to clean their browser cache. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the CSS links in header when asset manager is on:&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Assets on vanilla.jpg]]&lt;br /&gt;
&amp;lt;br /&amp;gt;As you can see they all refer to the tmp/ subfolders. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the CSS links in header when asset manager is off:&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Asset off.png]]&lt;br /&gt;
&amp;lt;br /&amp;gt;As you can see they point to the real files of the theme. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] Of course, if the Asset Manager doesn&#039;t know you changed the file, the old file from the old tmp/directory remain unchanged, and your changes will never be applied..&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, when you&#039;re editing CSS of a theme you have various possibilities:&lt;br /&gt;
*&#039;&#039;&#039;You can use the the LS Theme Editor:&#039;&#039;&#039; it deals with the asset manager and you don&#039;t have to worry about anything&lt;br /&gt;
*&#039;&#039;&#039;You can turn debug mode on:&#039;&#039;&#039; it will turn asset manager off, so the real css/js files of your themes are called (but then, you have to refresh your browser cache at each load)&lt;br /&gt;
* &#039;&#039;&#039;You can refresh the  assets cache&#039;&#039;&#039;: from Global Settings -&amp;gt; General -&amp;gt; Clear asset cache&lt;br /&gt;
&lt;br /&gt;
[[File:Clearassets-ls3 3.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] &#039;&#039;&#039;Using the theme editor to edit the custom CSS is by far the best solution.&#039;&#039;&#039; &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the theme editor will help you to understand the architecture of the new theme engine.&lt;br /&gt;
Also, if your customizing fruity, be careful with CSS specifity: most of the definitions use the selector &amp;quot;.fruity&amp;quot; (one of the class of the body element)&lt;br /&gt;
&lt;br /&gt;
== Adding custom fonts to my theme ==&lt;br /&gt;
=== The easy way: using Google Font CDN  ===&lt;br /&gt;
Bootswatch Survey Theme uses Google Font CDN. Let&#039;s have a look to how ti works:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/bootswatch/css/variations/flatly.min.css&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
@import url(&amp;quot;https://fonts.googleapis.com/css?family=Lato:400,700,400italic&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Lato font is used via CSS rules:&lt;br /&gt;
https://github.com/thomaspark/bootswatch/blob/master/dist/flatly/bootstrap.css#L72&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
body {&lt;br /&gt;
  ...&lt;br /&gt;
 font-family: &amp;quot;Lato&amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use any google font that way in your custom theme. Of course, you should remove the font selector from the options of your theme. Delete those lines in options.twig:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/options/options.twig#L209-L230&lt;br /&gt;
&lt;br /&gt;
=== Using local font  ===&lt;br /&gt;
Of course, you can also download the font files and use them from local server rather than from Google CDN (better for privacy). To have an example of how to it, here our local version of noto font:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/assets/fonts/noto.css&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
  font-family: &#039;Noto Sans&#039;;&lt;br /&gt;
  font-weight: 300;&lt;br /&gt;
  font-style: normal;&lt;br /&gt;
  src: url(&#039;./font-src/Noto/NotoSans-Regular.ttf&#039;);&lt;br /&gt;
}&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use a very similar definition in your theme css file, and then by copying the file NotoSans-Regular.ttf  in your theme css/font-src/ folder. &lt;br /&gt;
&lt;br /&gt;
Then, apply that font to your body (or any other element) like above, and remove the default option font selector.&lt;br /&gt;
&lt;br /&gt;
=== Creating your own font selector in options  ===&lt;br /&gt;
For now, you can&#039;t easily use the core font selector to add your own font in options. We need first to give the possibility to end user to upload custom packages (see next paragraph: A look into the Fruity Font Selector ) &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here how to proceed:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*Add two fonts (my_custom_font and my_custom_other_font) into your theme, using CDN or local server &lt;br /&gt;
*Then, in your css file, add two new classes:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
.font-my_custom_font {&lt;br /&gt;
 font-family: &#039;my_custom_font &#039;;&lt;br /&gt;
}&lt;br /&gt;
.font-my_custom_other_font {&lt;br /&gt;
 font-family: &#039;my_custom_other_font&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*In the XML file of your theme, add a font option (default one will be my_custom_font) :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;options&amp;gt;&lt;br /&gt;
        ....&lt;br /&gt;
        &amp;lt;font&amp;gt;my_custom_font&amp;lt;/font&amp;gt;&lt;br /&gt;
    &amp;lt;/options&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* in option.twig, add you font picker adding those lines (untested for now, so come complain to the forum if it doesn&#039;t work):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
            &lt;br /&gt;
            &amp;lt;div class=&#039;row ls-space margin top-15 bottom-15 action_hide_on_inherit&#039;&amp;gt;&lt;br /&gt;
                &amp;lt;hr/&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&#039;row action_hide_on_inherit&#039;&amp;gt;&lt;br /&gt;
                &amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
                    &amp;lt;div class=&#039;panel panel-default&#039;&amp;gt;&lt;br /&gt;
                        &amp;lt;div class=&#039;panel-heading&#039;&amp;gt;{{ &amp;quot;My custom fonts&amp;quot; | t }}&amp;lt;/div&amp;gt;&lt;br /&gt;
                        &amp;lt;div class=&#039;panel-body&#039;&amp;gt;&lt;br /&gt;
                            &amp;lt;div class=&#039;form-group row&#039;&amp;gt;&lt;br /&gt;
                                &amp;lt;label for=&#039;simple_edit_font&#039; class=&#039;control-label&#039;&amp;gt;{{ &amp;quot;Select font:&amp;quot; | t }}&amp;lt;/label&amp;gt;&lt;br /&gt;
                                &amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
                                    &amp;lt;select class=&#039;form-control selector_option_value_field&#039; id=&#039;simple_edit_font&#039; name=&#039;font&#039;&amp;gt;&lt;br /&gt;
                                    {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}&lt;br /&gt;
                                        {% set fontOptions = fontOptions ~ &#039;&amp;lt;option value = &amp;quot;inherit&amp;quot; &amp;gt; Inherit&amp;lt;/option&amp;gt;&#039; %}&lt;br /&gt;
                                    {% endif %}&lt;br /&gt;
                                   &amp;lt;optgroup  label=&amp;quot;{{ &amp;quot;My Custom fonts&amp;quot; | t }}&amp;quot;&amp;gt;&lt;br /&gt;
                                   &amp;lt;option class=&amp;quot;font-my_custom_font&amp;quot;     value=&amp;quot;custom_font&amp;quot;   data-font-package=&amp;quot;&amp;quot;  &amp;gt;Custom&amp;lt;/option&amp;gt;&lt;br /&gt;
                                  &amp;lt;option class=&amp;quot;font-my_custom_other_font&amp;quot; value=&amp;quot;my_custom_other_font&amp;quot; data-font-package=&amp;quot;&amp;quot;  &amp;gt;Other&amp;lt;/option&amp;gt;&lt;br /&gt;
                                  &amp;lt;/optgroup&amp;gt;&lt;br /&gt;
                                   &lt;br /&gt;
                                    &amp;lt;/select&amp;gt;&lt;br /&gt;
                                &amp;lt;/div&amp;gt;&lt;br /&gt;
                            &amp;lt;/div&amp;gt;&lt;br /&gt;
                        &amp;lt;/div&amp;gt;&lt;br /&gt;
                    &amp;lt;/div&amp;gt;&lt;br /&gt;
                &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Now your users should be able to choose between those two fonts.&lt;br /&gt;
&lt;br /&gt;
=== A look into the Fruity Font Selector ===&lt;br /&gt;
In the future, we&#039;ll give the possibility to final user to upload their own asset packages, including font packages. It will make very easy any customization of fonts. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
To understand Yii Packages:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.yiiframework.com/doc/api/1.1/CClientScript#packages-detail&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
LimeSurvey packages are defined in different files. Fonts packages are defined here:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/4c40b61afb0dba8fd80154b50f5831045df8d814/application/config/fonts.php&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For example, the Noto font package is defined here:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/4c40b61afb0dba8fd80154b50f5831045df8d814/application/config/fonts.php#L47-L53&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &#039;font-noto&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;devBaseUrl&#039; =&amp;gt; &#039;assets/fonts/&#039;,&lt;br /&gt;
        &#039;basePath&#039; =&amp;gt; &#039;fonts&#039;,&lt;br /&gt;
        &#039;css&#039; =&amp;gt; array(&lt;br /&gt;
            &#039;noto.css&#039;,&lt;br /&gt;
        ),&lt;br /&gt;
    ),&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The noto.css file it contains is here:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/4c40b61afb0dba8fd80154b50f5831045df8d814/assets/fonts/noto.css&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Notice the definition of the css class &amp;quot;.font-noto&amp;quot; at the end of it:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
@font-face {&lt;br /&gt;
  font-family: &#039;Noto Sans&#039;;&lt;br /&gt;
  ...&lt;br /&gt;
}&lt;br /&gt;
...&lt;br /&gt;
.font-noto{&lt;br /&gt;
    font-family: &#039;Noto Sans&#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, in Vanilla Theme, noto font is used by adding the noto package and defining the font option to noto:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/config.xml#L79&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;packages&amp;gt;&lt;br /&gt;
             ....&lt;br /&gt;
            &amp;lt;add&amp;gt;font-noto&amp;lt;/add&amp;gt;&lt;br /&gt;
        &amp;lt;/packages&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight &amp;gt;&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/config.xml#L58&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;options&amp;gt;&lt;br /&gt;
        ....&lt;br /&gt;
        &amp;lt;font&amp;gt;noto&amp;lt;/font&amp;gt;&lt;br /&gt;
    &amp;lt;/options&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Then, the body class font is defined using this value:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/views/layout_global.twig#L76&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;body class=&amp;quot; ...  font-{{  aSurveyInfo.options.font }} ... &amp;quot; ... &amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, the XML file only contains the default values for your template configuration. But indeed, those values are defined and read inside the database (table &amp;quot;template_configuration&amp;quot;) as json strings. The option.js file just use the value of the font selector of the simple option to change the value inside the advanced tab form:&lt;br /&gt;
https://github.com/LimeSurvey/LimeSurvey/blob/70a1d99cd2ebe411597231a8bc746b4ca9e19584/themes/survey/vanilla/options/options.js#L148-L174&lt;br /&gt;
&lt;br /&gt;
So when the &amp;quot;upload asset package&amp;quot; functionality will be available, it will be easy to add a script that scan all the existing font packages to add them in the selector.&lt;br /&gt;
&lt;br /&gt;
== Adding theme options to control positioning and display of survey elements  ==&lt;br /&gt;
This tutorial will show how to add options to an extended theme to display survey elements in various locations. In this case, we will create theme options to show the survey title intwo different locations.&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] For the sake of simplicity, we will base the tutorial on an extension of the &amp;quot;bootswatch&amp;quot; theme in LimeSurvey version 3.4.3.&amp;lt;/div&amp;gt;  &lt;br /&gt;
=== Create a custom theme  ===&lt;br /&gt;
#Extend the &amp;quot;bootswatch&amp;quot; theme as described above.&lt;br /&gt;
#Copy &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;custom.css&amp;lt;/span&amp;gt; to the local template as described above.&lt;br /&gt;
===Create new template options===&lt;br /&gt;
#Copy the contents of &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/bootswatch/options/&amp;lt;/span&amp;gt; to &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/options/&amp;lt;/span&amp;gt;.&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/options/options.twig&amp;lt;/span&amp;gt; in an editor and find &amp;quot;{# Bootstrap Bootswatch theme #}&amp;quot;. Directly before its parent  &amp;lt;nowiki&amp;gt;&amp;lt;div class=&#039;row&#039;&amp;gt;&amp;lt;/nowiki&amp;gt; element, add this:&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
		{# Custom survey name in navbar #}&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;div class=&#039;col-sm-12 col-md-6&#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;div class=&#039;form-group row&#039;&amp;gt;&lt;br /&gt;
					&amp;lt;label for=&#039;simple_edit_options_surveyname1&#039; class=&#039;control-label&#039;&amp;gt;Survey name in navbar&amp;lt;/label&amp;gt;&lt;br /&gt;
					&amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
						&amp;lt;div class=&amp;quot;btn-group&amp;quot; data-toggle=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname1&#039; type=&#039;radio&#039; value=&#039;on&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname1&#039;/&amp;gt;&lt;br /&gt;
								Yes&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname1&#039; type=&#039;radio&#039; value=&#039;off&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname1&#039;/&amp;gt;&lt;br /&gt;
								No&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
						&amp;lt;/div&amp;gt;&lt;br /&gt;
					&amp;lt;/div&amp;gt;&lt;br /&gt;
				&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;hr/&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		{# Custom survey name below progress bar #}&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;div class=&#039;col-sm-12 col-md-6&#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
				&amp;lt;div class=&#039;form-group row&#039;&amp;gt;&lt;br /&gt;
					&amp;lt;label for=&#039;simple_edit_options_surveyname2&#039; class=&#039;control-label&#039;&amp;gt;Survey name below progress bar&amp;lt;/label&amp;gt;&lt;br /&gt;
					&amp;lt;div class=&#039;col-sm-12&#039;&amp;gt;&lt;br /&gt;
						&amp;lt;div class=&amp;quot;btn-group&amp;quot; data-toggle=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname2&#039; type=&#039;radio&#039; value=&#039;on&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname2&#039;/&amp;gt;&lt;br /&gt;
								Yes&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
							&amp;lt;label class=&amp;quot;btn btn-default&amp;quot;&amp;gt;&lt;br /&gt;
								&amp;lt;input name=&#039;surveyname2&#039; type=&#039;radio&#039; value=&#039;off&#039; class=&#039;selector_option_radio_field &#039; data-id=&#039;simple_edit_options_surveyname2&#039;/&amp;gt;&lt;br /&gt;
								No&lt;br /&gt;
							&amp;lt;/label&amp;gt;&lt;br /&gt;
						&amp;lt;/div&amp;gt;&lt;br /&gt;
					&amp;lt;/div&amp;gt;&lt;br /&gt;
				&amp;lt;/div&amp;gt;&lt;br /&gt;
			&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div class=&#039;row&#039;&amp;gt;&lt;br /&gt;
			&amp;lt;hr/&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/config.xml&amp;lt;/span&amp;gt; and add two items to the &amp;quot;options&amp;quot; block so it looks like this:&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;    &amp;lt;options&amp;gt;&lt;br /&gt;
        &amp;lt;ajaxmode&amp;gt;on&amp;lt;/ajaxmode&amp;gt;&lt;br /&gt;
        &amp;lt;brandlogo&amp;gt;on&amp;lt;/brandlogo&amp;gt;&lt;br /&gt;
        &amp;lt;brandlogofile&amp;gt;./files/logo.png&amp;lt;/brandlogofile&amp;gt;&lt;br /&gt;
        &amp;lt;container&amp;gt;on&amp;lt;/container&amp;gt;&lt;br /&gt;
        &amp;lt;surveyname1&amp;gt;on&amp;lt;/surveyname1&amp;gt;&lt;br /&gt;
        &amp;lt;surveyname2&amp;gt;on&amp;lt;/surveyname2&amp;gt;&lt;br /&gt;
    &amp;lt;/options&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#This should give you two new options in the Theme Options screen like this:&amp;lt;br /&amp;gt;[[File:Tutorial_tp_1_1.png]]&lt;br /&gt;
===Modifed view for Survey Title in the navbar===&lt;br /&gt;
#Create a new directory &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/views/subviews/header/&amp;lt;/span&amp;gt;.&lt;br /&gt;
#Copy &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/header/nav_bar.twig&amp;lt;/span&amp;gt; to that new directory.&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/header/nav_bar.twig&amp;lt;/span&amp;gt; and find &amp;quot;{# Logo option #}&amp;quot;. Under that, modify the IF statement for the logo/survey-name, so it looks like this:&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
		{# Logo option #}&lt;br /&gt;
        {% if( aSurveyInfo.options.brandlogo == &amp;quot;on&amp;quot;) %}&lt;br /&gt;
            &amp;lt;div class=&amp;quot;{{ aSurveyInfo.class.navbarbrand }} logo-container&amp;quot;  {{ aSurveyInfo.attr.navbarbrand }}  &amp;gt;&lt;br /&gt;
                {{ image(aSurveyInfo.options.brandlogofile, aSurveyInfo.name, {&amp;quot;class&amp;quot;: &amp;quot;logo img-responsive&amp;quot;}) }}&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        {% endif %}&lt;br /&gt;
        {% if( aSurveyInfo.options.surveyname1 == &amp;quot;on&amp;quot;) %}&lt;br /&gt;
            &amp;lt;div class=&amp;quot;{{ aSurveyInfo.class.navbarbrand }}&amp;quot;  {{ aSurveyInfo.attr.navbarbrand }} &amp;gt;&lt;br /&gt;
                {{ aSurveyInfo.name }}&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
        {% endif %}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add something like this to &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/css/custom.css&amp;lt;/span&amp;gt;:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.navbar-brand {&lt;br /&gt;
    line-height: 60px;&lt;br /&gt;
    font-size: 32px;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Toggle the &amp;quot;Survey name in navbar&amp;quot; theme option to &amp;quot;Yes&amp;quot;&lt;br /&gt;
#You should see this:&amp;lt;br /&amp;gt;[[File:Tutorial_tp_1_2.png]]&lt;br /&gt;
===Modifed view for Survey Title under progress bar===&lt;br /&gt;
#Create a new directory &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/views/subviews/survey/group_subviews&amp;lt;/span&amp;gt;.&lt;br /&gt;
#Copy &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/survey/group_subviews/group_container.twig&amp;lt;/span&amp;gt; to that new directory.&lt;br /&gt;
#Open &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/themes/survey/vanilla/views/subviews/survey/group_subviews/group_container.twig&amp;lt;/span&amp;gt; and add an &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt;&amp;lt;/nowiki&amp;gt; element for the survey name. So it looks like this:&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;{{ aSurveyInfo.class.groupcontainer }} space-col&amp;quot; {{ aSurveyInfo.attr.groupcontainer }}&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    {# Custom survey name #}&lt;br /&gt;
    {% if( aSurveyInfo.options.surveyname2 == &amp;quot;on&amp;quot;) %}&lt;br /&gt;
    	&amp;lt;h1 class=&amp;quot;custom-survey-name&amp;quot;&amp;gt;{{ aSurveyInfo.name }}&amp;lt;/h1&amp;gt;&lt;br /&gt;
    {% endif %}&lt;br /&gt;
 &lt;br /&gt;
    {# Group Name #}&lt;br /&gt;
    {{ include(&#039;./subviews/survey/group_subviews/group_name.twig&#039;) }}&lt;br /&gt;
 &lt;br /&gt;
    {# Group Description #}&lt;br /&gt;
    {{ include(&#039;./subviews/survey/group_subviews/group_desc.twig&#039;) }}&lt;br /&gt;
 &lt;br /&gt;
    {#&lt;br /&gt;
        PRESENT THE QUESTIONS&lt;br /&gt;
 &lt;br /&gt;
        This is the main part. It will render each question for this group&lt;br /&gt;
     #}&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;!-- PRESENT THE QUESTIONS --&amp;gt;&lt;br /&gt;
    {% for  aQuestion in aGroup.aQuestions %}&lt;br /&gt;
         {{ include(&#039;./subviews/survey/question_container.twig&#039;) }}&lt;br /&gt;
    {% endfor %}&lt;br /&gt;
 &lt;br /&gt;
    &amp;lt;!-- Hidden inputs --&amp;gt;&lt;br /&gt;
    {% if aGroup.show_last_group == true %}&lt;br /&gt;
        &amp;lt;input type=&#039;hidden&#039; name=&#039;lastgroup&#039; value=&#039;{{ aGroup.lastgroup }}&#039; id=&#039;lastgroup&#039; /&amp;gt;&lt;br /&gt;
    {% endif %}&lt;br /&gt;
 &lt;br /&gt;
    {% if aGroup.show_last_answer == true %}&lt;br /&gt;
        &amp;lt;input type=&#039;hidden&#039; name=&#039;lastanswer&#039; value=&#039;{{ aGroup.lastanswer }}&#039; id=&#039;lastanswer&#039; /&amp;gt;&lt;br /&gt;
    {% endif %}&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Add something like this to &amp;lt;span style=&amp;quot;color: #BA2121;&amp;quot;&amp;gt;/upload/themes/survey/yourThemeName/css/custom.css&amp;lt;/span&amp;gt;:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;.navbar-brand {&lt;br /&gt;
    line-height: 60ph1.custom-survey-name {&lt;br /&gt;
	margin: 0;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Toggle the &amp;quot;Survey name below progress bar&amp;quot; theme option to &amp;quot;Yes&amp;quot;&lt;br /&gt;
#You should see this:&amp;lt;br /&amp;gt;[[File:Tutorial_tp_1_3.png]]&lt;br /&gt;
&lt;br /&gt;
===Downloads===&lt;br /&gt;
* Sample extended theme: [[Media:Test_survey_names.zip]]&lt;br /&gt;
&lt;br /&gt;
=Creating a template from scratch=&lt;br /&gt;
Documentation coming soon...&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;:  if you edit the XML file of a theme, you must uninstall and reinstall the theme so it&#039;s taken into account. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;:  to avoid that, you can force the use to the XML rather than DB. In config.php turn debug mode on and uncommment:&lt;br /&gt;
&lt;br /&gt;
&#039;force_xmlsettings_for_survey_rendering&#039; =&amp;gt; true, // Uncomment if you want to force the use of the XML file rather than DB (for easy theme development) &lt;br /&gt;
&lt;br /&gt;
Becareful: everything will be loaded from the XML (included options, etc)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;:  if you manually edit the CSS/JS files (without using the Teeme Editor), and if debug mode is off, you can now force the asset to be flushed. In &amp;quot;Global Settings&amp;quot;, &amp;quot;General tab&amp;quot;, click the button &amp;quot;Clear assets cache:&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:Test_survey_names.zip&amp;diff=90214</id>
		<title>File:Test survey names.zip</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:Test_survey_names.zip&amp;diff=90214"/>
		<updated>2018-03-05T23:16:30Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:Tutorial_tp_1_3.png&amp;diff=90213</id>
		<title>File:Tutorial tp 1 3.png</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:Tutorial_tp_1_3.png&amp;diff=90213"/>
		<updated>2018-03-05T23:12:48Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:Tutorial_tp_1_2.png&amp;diff=90212</id>
		<title>File:Tutorial tp 1 2.png</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:Tutorial_tp_1_2.png&amp;diff=90212"/>
		<updated>2018-03-05T23:12:31Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:Tutorial_tp_1_1.png&amp;diff=90211</id>
		<title>File:Tutorial tp 1 1.png</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:Tutorial_tp_1_1.png&amp;diff=90211"/>
		<updated>2018-03-05T23:08:52Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Question_groups_-_introduction&amp;diff=88263</id>
		<title>Question groups - introduction</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Question_groups_-_introduction&amp;diff=88263"/>
		<updated>2018-02-18T18:41:57Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;languages /&amp;gt; &amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:14--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] Please note that the below explanations and screenshots are based on LimeSurvey 3.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create question group= &amp;lt;!--T:15--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:16--&amp;gt;&lt;br /&gt;
There are two ways through which you can start adding question groups to your survey:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:17--&amp;gt;&lt;br /&gt;
* Access the [[Overview]] tab from the [[Survey settings|survey settings menu]]. Locate the &#039;&#039;&#039;add new group&#039;&#039;&#039; button in the &#039;&#039;Survey summary&#039;&#039; section and create your question group:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:18--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[FIle:Option 1 - create a question group.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:19--&amp;gt;&lt;br /&gt;
* Access the [[Survey structure|survey structure]] page and locate in the left menu the &#039;&#039;&#039;add question group&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
&amp;lt;!--T:20--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Option 2 - create a question group.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:21--&amp;gt;&lt;br /&gt;
After you click on it, the add question group panel will be showed up:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:22--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Add question group panel.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
Please note that you can create as many groups as you like!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:23--&amp;gt;&lt;br /&gt;
The following fields will be displayed:&lt;br /&gt;
*&#039;&#039;&#039;Title:&#039;&#039;&#039; Type in this box the name you wish to give to the question group;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Description:&#039;&#039;&#039; This field allows you to publish an explanatory note for any set of questions. If you add a description, it will be presented along the survey before commencing any of the questions in that group. If no text is added, then public participants will simply move straightaway to the survey questions. You can use the HTML editor to include images, formatted text, etc. to your liking;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Randomization group:&#039;&#039;&#039; To start randomizing a question group, enter a string into the field such as &#039;&#039;randgroup1&#039;&#039;. You will need to enter that same string in all question groups that you want to randomize and which will then appear in a random order when taking the survey. Only places &amp;lt;u&amp;gt;inside&amp;lt;/u&amp;gt; the same group will be randomly switched!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:10--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Relevance equation:&#039;&#039;&#039; You can set a &amp;quot;relevance equation&amp;quot; in this field for the group with the help of the [[Expression Manager|Expression Manager]]. This is helpful for &amp;quot;looping&amp;quot; or other cases where you are repeating similar content multiple times. For example, say you want to ask the same set of follow-up questions for each child in a household and you have asked how many children are there via a question named &#039;&#039;numKids&#039;&#039;. Then, for each group of follow-up questions you would have to use relevance equations (which would collect data about the third child) such as: &#039;&#039;&#039;numKids == 3&#039;&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] &#039;&#039;&#039;Note:&#039;&#039;&#039; An explanation and example for hiding question groups are available in the [[Expression Manager Examples#Hide_question_group_if_answer_from_previous_question_is_Yes_or_No|Expression Manager examples wiki subsection]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;[[File:help.png]] &#039;&#039;&#039;Hint:&#039;&#039;&#039; Groups can be used to group questions in a survey. If you are going to have multiple groups, you should note that the survey questions will be displayed group by group by default (you can change that from your [[General settings|survey settings]]). To display the groups in a particular order use the group reordering feature. If you have only one group in your survey then the name of this group is irrelevant (except for the survey format).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Add question group toolbar== &amp;lt;!--T:24--&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:25--&amp;gt;&lt;br /&gt;
You may find on the top toolbar the following options:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:26--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Add question group - toolbar.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:27--&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Display/Export&#039;&#039;&#039;: This function is used to export your whole survey in different formats;&lt;br /&gt;
* &#039;&#039;&#039;Survey participants:&#039;&#039;&#039; Clicking on this button will redirect the survey administrator to his/her [[Survey participants|survey participants table]];&lt;br /&gt;
* &#039;&#039;&#039;Responses:&#039;&#039;&#039; If the survey is active, the button becomes visible. It offers you access to the responses table; &lt;br /&gt;
* &#039;&#039;&#039;Import a group:&#039;&#039;&#039; Besides the two ways [[Question groups - introduction#Create question group|mentioned above]], new question groups can also be added via the [[Question groups - introduction#Import a question group|import group function]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Import a question group== &amp;lt;!--T:28--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:29--&amp;gt;&lt;br /&gt;
You can also import a question group (.lsg file format) that was previously exported from a LimeSurvey survey. First, access the &#039;&#039;&#039;add question group&#039;&#039;&#039; option and then locate on the top toolbar the import question group function:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:30--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Import question group 1.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:31--&amp;gt;&lt;br /&gt;
Browse your computer/server and upload the .lsg file that contains the question group you wish to import.&lt;br /&gt;
&lt;br /&gt;
=Question group actions= &amp;lt;!--T:32--&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:33--&amp;gt;&lt;br /&gt;
After the creation of a survey, you can access the newly created group from the [[Survey structure|survey structure]] menu. The following page will be displayed:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:34--&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Question group - after its creation.png]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:35--&amp;gt;&lt;br /&gt;
The page is divided in three sections:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:36--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Question group toolbar:&#039;&#039;&#039; You may find on the toolbar the following options:&lt;br /&gt;
**&#039;&#039;Preview survey/question group:&#039;&#039; Click on one of the two buttons to either preview your whole survey or only the current question group. If additional languages were added to your survey, the survey/question group can be previewed in each language of the survey. Just simply click on one of the two &#039;&#039;preview&#039;&#039; buttons and select the desired language;&lt;br /&gt;
**&#039;&#039;Edit current question group:&#039;&#039; Click on this button if you wish to edit the title, description, relevance equation, or randomization group of the current question group;&lt;br /&gt;
**&#039;&#039;Check survey logic for current question group:&#039;&#039; It helps you see the possible errors that might exist within a question group - it is especially useful when the [[Expression Manager|expression manager]] is employed.&lt;br /&gt;
**&#039;&#039;Delete current question group:&#039;&#039; If you wish to delete the current question group, click on this button.&lt;br /&gt;
**&#039;&#039;Export this question group:&#039;&#039; If you wish to export this question group to later import it into another LimeSurvey survey, click on this button. The file will be exported in the .lsg format.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:37--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Group summary:&#039;&#039;&#039; The main [[Question groups - introduction#Create question group|question group details are displayed]];&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:38--&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;Group quick actions:&#039;&#039;&#039; It allows the you to quickly perform question-groups-related actions - in our case, the add new question to group option is displayed. To find out more about questions, read our [[Questions - introduction|introductory wiki section on question]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Reordering question groups= &amp;lt;!--T:39--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--T:40--&amp;gt;&lt;br /&gt;
The question groups and questions can be reordered as many times as you like. For further details, check the following [[Survey structure#Reordering questions and question groups|survey structure wiki subsection]].&lt;br /&gt;
&lt;br /&gt;
=Examples= &amp;lt;!--T:41--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=87807</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=87807"/>
		<updated>2018-02-14T22:32:07Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Version 3.x */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have sub-questions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with sub-question relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.06)&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary sub-questions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one sub-question at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the sub-question with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The sub-question code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 and 2.73.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.06:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.73.0:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.54:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with sub-questions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with sub-questions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with sub-questions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with sub-questions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create sub-questions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last sub-questions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=87806</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=87806"/>
		<updated>2018-02-14T22:30:24Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Card Sorting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have sub-questions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with sub-question relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.06)&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary sub-questions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one sub-question at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the sub-question with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The sub-question code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 and 2.73.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.06:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.73.0:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.54:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with sub-questions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with sub-questions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.06,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with sub-questions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with sub-questions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Version 3.x==&lt;br /&gt;
Here is a custom question theme for card Sorting in 3.x. (note that this interface is not optimal for small screen sizes)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Extract the custom question theme linked below and upload it to /limesurvey/upload/themes/question/.&lt;br /&gt;
&lt;br /&gt;
2) Create a multiple-short-text question, click Save.&lt;br /&gt;
&lt;br /&gt;
3) Set the question setting &amp;quot;Question theme&amp;quot; to &amp;quot;cardSort&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_1.png]]&lt;br /&gt;
&lt;br /&gt;
4) In the question setting &amp;quot;Sorting area names&amp;quot; field, enter a comma-separated list of the names for the sorting &amp;quot;buckets&amp;quot;, click Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Card_sort_3.x_2.png]]&lt;br /&gt;
&lt;br /&gt;
5) Create sub-questions as required.&lt;br /&gt;
&lt;br /&gt;
6) The styles for the theme can be modified in /limesurvey/upload/themes/question/cardSort/survey/questions/answer/multipleshorttext/assets/css/cardsort.css.&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_3.x_3.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloads:&#039;&#039;&#039;&lt;br /&gt;
Custom question theme - [[Media:CardSort.zip]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Sample survey - [[Media:Card_sort_test_survey.zip]]&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last sub-questions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:Card_sort_test_survey.zip&amp;diff=87805</id>
		<title>File:Card sort test survey.zip</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:Card_sort_test_survey.zip&amp;diff=87805"/>
		<updated>2018-02-14T22:27:05Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:CardSort.zip&amp;diff=87804</id>
		<title>File:CardSort.zip</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:CardSort.zip&amp;diff=87804"/>
		<updated>2018-02-14T22:25:03Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:Card_sort_3.x_3.png&amp;diff=87803</id>
		<title>File:Card sort 3.x 3.png</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:Card_sort_3.x_3.png&amp;diff=87803"/>
		<updated>2018-02-14T22:24:41Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:Card_sort_3.x_2.png&amp;diff=87802</id>
		<title>File:Card sort 3.x 2.png</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:Card_sort_3.x_2.png&amp;diff=87802"/>
		<updated>2018-02-14T22:24:20Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=File:Card_sort_3.x_1.png&amp;diff=87801</id>
		<title>File:Card sort 3.x 1.png</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=File:Card_sort_3.x_1.png&amp;diff=87801"/>
		<updated>2018-02-14T22:22:31Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=85155</id>
		<title>Workarounds: Manipulating a survey at runtime using Javascript</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript&amp;diff=85155"/>
		<updated>2018-01-29T13:11:20Z</updated>

		<summary type="html">&lt;p&gt;Tpartner: /* Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Often you want to manipulate certain elements of a survey at runtime. The only solution without touching the source code is to use JavaScript or jQuery which is shipped with LimeSurvey. Here are some examples to hide and style elements, validate user input or do calculations at runtime.&lt;br /&gt;
&lt;br /&gt;
Other workarounds can be found at&lt;br /&gt;
* [[Workarounds: Survey behaviour]]&lt;br /&gt;
* [[Workarounds: Question design, layout and templating]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;&amp;lt;center&amp;gt;&amp;lt;br /&amp;gt;&#039;&#039;&#039;Please keep in mind that these workarounds are not official LimeSurvey extensions - they are solutions that users have created for themselves.&amp;lt;br /&amp;gt;&amp;lt;span style=&#039;color:#EE0000,#FFFFFF&#039;&amp;gt;Therefore LimeSurvey can&#039;t offer guarantees or support for these solutions.&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;If you have questions, please contact the users that, thankfully, shared their solutions with the community.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Note:  Expression Manager (EM) may cause some of these work-arounds to fail.  Any custom javascript included as a .js file will be fine.  However, if you in-line your JavaScript code, you must make sure that you have a space after every opening (left) curly brace, and a space before every closing (right) curly brace.  Otherwise, Expression Manager (EM) will think that the content between the curly braces is something it should parse and understand.  I have fixed all of the work-arounds below that can be fixed (many did not follow those rules).  However, some will continue to break.  If a work-around contains a regular expression which contains curly braces (to indicate a range of repeats of a sub-expression), EM will try to process those curly braces, and thus break your regular expression.  Strategies to continue to support that work-around functionality are discussed below.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; a javascript workaround solution to this Wiki page?=&lt;br /&gt;
&lt;br /&gt;
Well, this is pretty easy. Click the edit icon and create your own headline within the javascript section starting with &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot;. Then add a short note about the version you have used when creating your workaround, you can copy/paste this code snippet &amp;lt;nowiki&amp;gt;&#039;&#039;Tested with: (enter LimeSurvey version and maybe browser)&#039;&#039;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally it&#039;s imported to mark all your code with code tags, other wise you might break this page.&lt;br /&gt;
*Start tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
*End tag: &#039;&#039;&#039;&amp;lt;nowiki&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;use&#039;&#039; Script (eg. JavaScript etc.) in LimeSurvey=&lt;br /&gt;
&lt;br /&gt;
To use JavaScript within LimeSurvey, the XSS filter must be turned off and the code inserted in the source of a question or a group description.&lt;br /&gt;
*Go to Global settings --&amp;gt; Security and set &amp;quot;Filter HTML for XSS&amp;quot; to &amp;quot;Off&amp;quot;.&lt;br /&gt;
* [http://docs.limesurvey.org/tiki-index.php?page=Adding+A+Question Add a new question]&lt;br /&gt;
* Edit the question and click the &amp;quot;Source&amp;quot; button in the editor toolbar:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_1.png]]&lt;br /&gt;
* Enter your script after the question text:&lt;br /&gt;
&lt;br /&gt;
   [[File:Editor_2.png]]&lt;br /&gt;
* Save the question&lt;br /&gt;
&lt;br /&gt;
A simple test to see if JavaScript is enabled is to echo an alert. Use this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good practice to use the jQuery $(document).on(&#039;ready pjax:complete&#039;) event to prevent the code from executing until the page is fully loaded, it is especially needed when using the ajax-mode in the 3.0.0 and upper default templates:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
       alert(&amp;quot;Test!&amp;quot;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage of brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;)===&lt;br /&gt;
{{Alert|title=Caution when using brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) in scripts|text=[[Expression Manager#Syntax|Expression manager]] uses brackets (&amp;lt;nowiki&amp;gt;{ and }&amp;lt;/nowiki&amp;gt;) to enclose expressions. If you have to use brackets in your JavaScript, you must add a space or line feed after the opening bracket (&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;) and before the closing bracket (&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;) }}&lt;br /&gt;
&lt;br /&gt;
===Examples of usage of brackets===&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {console.log(&#039;broken javascript&#039;);});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding line feed prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   $(function() {&lt;br /&gt;
      console.log(&#039;Adding a line feed for javascript&#039;);&lt;br /&gt;
   });&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expression Manager will try to parse this JavaScript: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) {console.log(&#039;broken javascript&#039;);};&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding spaces inside the brackets prevents Expression Manager from parsing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
   if(myvar==1) { console.log(&#039;Adding a space for javascript&#039;); };&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Sum up input values using Javascript=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the sum() function in [[Expression Manager|Expression Manager]].  See this [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Starting in  Version 1.92, you also do no longer need to use SGQA (e.g. 45251X1X5) identifiers. Instead the code &amp;lt;code&amp;gt;{SGQ}&amp;lt;/code&amp;gt; will automatically replaced by the current questions SGQA-codes.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from a survey that is a invitation to a longer party, when the user clicks to the next page, the calculated results will be shown.&lt;br /&gt;
&lt;br /&gt;
If you wonder what the {INSERTANS:1X6X12} stuff is, look at [http://docs.limesurvey.org/tiki-index.php?page=SGQA+Identifier SGQA identifier] and [[Adding a question#Information from previous answers|Using information from previous answers]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html4strict&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: left&amp;quot;&amp;gt;These are your answers:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;u&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;script LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
partyprice = 3;&lt;br /&gt;
&lt;br /&gt;
beadclothprice = 3;&lt;br /&gt;
&lt;br /&gt;
breakfastprice = 7;&lt;br /&gt;
&lt;br /&gt;
lunchprice = 8;&lt;br /&gt;
&lt;br /&gt;
dinnerprice = 10;&lt;br /&gt;
&lt;br /&gt;
foodtotal = 0;&lt;br /&gt;
&lt;br /&gt;
var isreallytrue = &amp;quot;Yes&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var noanswer = &amp;quot;No answer&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
document.write( &amp;quot;Can you come? = {INSERTANS:45251X1X1}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:45251X1X1}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X3}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X3}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
   partypeople = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   partytotal = partyprice * partypeople;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;It&#039;s {INSERTANS:45251X1X3} persons who will come = &amp;quot; + partytotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X4}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X4}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   beadcloths = parseInt(answer);&lt;br /&gt;
&lt;br /&gt;
   beadclothtotal = beadclothprice * beadcloths;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;You want to borrow {INSERTANS:45251X1X4} beadcloths = &amp;quot; + beadclothtotal + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there thursday? = {INSERTANS:45251X1X5}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;On friday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X71}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X71}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   breakfastfriday = parseInt(answer) * breakfastprice;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X72}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X72}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   lunchfriday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X73}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
   else { answer = &amp;quot;{INSERTANS:45251X1X73}&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
   dinnerfriday = parseInt(answer)* dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnerfriday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   foodtotal = breakfastfriday + lunchfriday + dinnerfriday;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there saturday? = {INSERTANS:45251X1X8}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X8}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On saturday you will have these meals: &amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X91}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X91}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsaturday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write(&amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X92}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X92}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsaturday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X93}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X93}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersaturday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersaturday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsaturday + lunchsaturday + dinnersaturday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;Will you be there sunday? = {INSERTANS:45251X1X10}&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if (&amp;quot;{INSERTANS:45251X1X10}&amp;quot; == isreallytrue )&lt;br /&gt;
&lt;br /&gt;
      {&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;On sunday you will have these meals: &amp;lt;br&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X111}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X111}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       breakfastsunday = parseInt(answer) * breakfastprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; breakfeasts = &amp;quot; + breakfastsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot;  );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X112}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X112}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       lunchsunday = parseInt(answer) * lunchprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; lunches = &amp;quot; + lunchsunday + &amp;quot;&amp;amp;euro;&amp;lt;BR&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       if (&amp;quot;{INSERTANS:45251X1X113}&amp;quot;== noanswer) { answer = 0; }&lt;br /&gt;
&lt;br /&gt;
       else { answer = &amp;quot;{INSERTANS:45251X1X113}&amp;quot;; }&lt;br /&gt;
&lt;br /&gt;
       dinnersunday = parseInt(answer) * dinnerprice ;&lt;br /&gt;
&lt;br /&gt;
       document.write( &amp;quot;&#039;&#039;&#039;_ &amp;quot; + answer + &amp;quot; dinners = &amp;quot; + dinnersunday + &amp;quot;&amp;amp;euro;&amp;lt;p&amp;gt;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
       foodtotal = foodtotal + breakfastsunday + lunchsunday + dinnersunday;&lt;br /&gt;
&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
   total = partytotal + beadclothtotal + foodtotal;&lt;br /&gt;
&lt;br /&gt;
   document.write( &amp;quot;&amp;lt;h3&amp;gt;In total it will cost you &amp;quot; + total + &amp;quot;&amp;amp;euro;&amp;lt;/h3&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   Put that sum in this bank account 1234 5678 9012&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Question Validation=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the min/max/equals_num_value attributes (to validate sums), or the em_validation_q function, which lets you refer to other variables when you validate the current question [[Expression Manager|Expression Manager]].  Such validations also work on the current page, and properly handle array_filter and cascading relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround is in case you need to do some validation involving more than one question, it implies a very little JavaScript programming and the use of SGQA Identifiers; this should work on almost any version of LimeSurvey.&lt;br /&gt;
&lt;br /&gt;
Is easy to explain with an example, we need to do a survey of the percentage of males and females and we want to be sure that the sum is 100, to do this follow this steps (the necessary data that is not indicated in these instructions are not important i.e. question codes, etc.):&lt;br /&gt;
#Create a new survey of type &amp;quot;group by group&amp;quot;, set the &amp;quot;Show |&amp;lt;&amp;lt; Prev| button&amp;quot; to yes and note the SID.&lt;br /&gt;
#Add a new group called &amp;quot;Group 1&amp;quot; and note the GID.&lt;br /&gt;
#Add a new question &amp;quot;Percent of males&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID1).&lt;br /&gt;
#Add a new question &amp;quot;Percent of females&amp;quot; of type &amp;quot;numeric&amp;quot;, make it mandatory and note the QID (we will refer to this as QID2).&lt;br /&gt;
#Add a new group called &amp;quot;Group 2&amp;quot;&lt;br /&gt;
#Add a new non mandatory question, here is the trick the question text has to be (be sure to replace the SID, GID, QID1 and QID2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function validation()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   if [[{INSERTANS:SIDXGIDXQID1}+{INSERTANS:SIDXGIDXQID2}) != 100)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     alert(&amp;quot;Your responses don&#039;t sum 100! Check them&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.move.value = &#039;movelast&#039;;&lt;br /&gt;
&lt;br /&gt;
     document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this will show shortly the question and will jump to the end page, a little weird for the survey taker but works.&lt;br /&gt;
&lt;br /&gt;
This is a proof of concept, and may have some problems, please if you notice something or improve it send me an e-mail to leochaton-limesurvey at yahoo dot com.&lt;br /&gt;
&lt;br /&gt;
This will work for 2 questions that you want to be the same.  Works well for email and confirm email questions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 function validation() {&lt;br /&gt;
&lt;br /&gt;
 if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; != &amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
    alert(&amp;quot;Your responses don&#039;t match Check them&amp;quot;); document.limesurvey.move.value = &#039;moveprev&#039;;&lt;br /&gt;
&lt;br /&gt;
    document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 setTimeout(&amp;quot;validation()&amp;quot;,250);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternate exit=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using the same idea of the previous post, you can implement an alternate exit of your survey.&lt;br /&gt;
&lt;br /&gt;
This script should be in the first question to be displayed in a next page after the question that should trigger the alternate exit. In this example the question that trigger the alternate exit is a Yes/No question, if the user chooses no, he is redirected to another page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if (&amp;quot;{INSERTANS:SIDXGIDXQID}&amp;quot; == &amp;quot;No&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  window.location=&amp;quot;http://www.limesurvey.org&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: &#039;All browsers&#039;, LimeSurvey 1.70 and up&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
This simple workaround describes how to &#039;&#039;&#039;add a custom Javascript code&#039;&#039;&#039; that is triggered right after the page is loaded. It may have numerous applications, especially when you deal with a custom JS/HTML code. It may be used to hide form elements (&amp;lt;input&amp;gt;  tags), make them read-only, display alert messages, etc.&lt;br /&gt;
&lt;br /&gt;
To run any Javascript code right after page load use the Query ready() function. It will be executed when the page is being loaded. For example when you add the following code to one of your question definitions...:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;onload alert!&#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...it will display a pop-up message immediately after the page has been loaded.&lt;br /&gt;
&lt;br /&gt;
Some of the applications of this trick I&#039;ve explored are:&lt;br /&gt;
&lt;br /&gt;
a) Hiding the form elements by calling in your Custom_On_Load:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: As of svn build 9755, you can now dynamically reference the questions input fields by using the {SGQ} keyword. You can rewrite the previous example like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer{SGQ}&amp;quot;).style.display=&#039;none&#039;;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this makes it a little easier when exporting surveys, so you don&#039;t have to worry about manually entering each questions SurveyGroupQuestion ID.&lt;br /&gt;
&lt;br /&gt;
b) Making the elements read only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;document.getElementById(&amp;quot;answer73166X16X54&amp;quot;).readOnly=true;&amp;lt;/syntaxhighlight&amp;gt; where the &amp;quot;answer73166X16X54&amp;quot; structure has been described in one of other workarounds above.&lt;br /&gt;
&lt;br /&gt;
c) For Hiding by a lot of elements by calling in your Customer_On_Load&lt;br /&gt;
&lt;br /&gt;
jQuery searchs in html document for input-fields with radio type, if his answer text empty then do the display css set to none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
           function() {&lt;br /&gt;
&lt;br /&gt;
             jQuery(&#039;input:radio&#039;).each(&lt;br /&gt;
&lt;br /&gt;
               function() {&lt;br /&gt;
&lt;br /&gt;
                 var s = jQuery(this);&lt;br /&gt;
&lt;br /&gt;
                 var c = s.parent().children(&#039;.answertext&#039;);&lt;br /&gt;
&lt;br /&gt;
                 for(var i=0; i &amp;lt; c.length; i++) {&lt;br /&gt;
&lt;br /&gt;
                   var a = jQuery(c[i]]);&lt;br /&gt;
&lt;br /&gt;
                   if(this.id &amp;lt;/u&amp;gt; a.attr(&#039;for&#039;) &amp;amp;&amp;amp; a.text() == &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
                     s.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     a.css({ &#039;display&#039; : &#039;none&#039; });&lt;br /&gt;
&lt;br /&gt;
                     break;&lt;br /&gt;
&lt;br /&gt;
                   }&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
             )&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advanced usage==&lt;br /&gt;
&lt;br /&gt;
If you want to place global Javascript code using the above jQuery(document).ready function then the best place to do this is the template javascript file template.js. You can edit this file using the template editor. Please be aware that placing it in the template javascript file will make the function available to all surveys using that template. If needed just create a new template copy for your survey.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can place the jQuery(document).ready function in the group description to make a Javascript function only available to a certain question group.&lt;br /&gt;
&lt;br /&gt;
==Language-specific Javascript code==&lt;br /&gt;
&lt;br /&gt;
There is an easy way to find out the current language and execute according Javascript using jQuery: The &amp;lt;html&amp;gt; tag of any survey pages contains an &#039;lang&#039; attribute which holds the current language code. You can read that language code by using the followin code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
       languagecode=$(&#039;html&#039;).attr(&#039;lang&#039;);&lt;br /&gt;
&lt;br /&gt;
       alert(&#039;This is the current language code: &#039;+languagecode);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an English survey the above code would show a messagebox with &amp;quot;This is the current language code: en&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Custom onload function in multi-language survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2,&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To use custom onload functions, as above, in multi-language surveys you must define the functions in the question source for &#039;&#039;&#039;all&#039;&#039;&#039; languages.&lt;br /&gt;
&lt;br /&gt;
While this initially seems to be a bit tedious, it actually can be useful - you can alter your onload functions depending on the language in use. For example, you can dynamically display alerts or element contents in the current language.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a question with the answer of another=&lt;br /&gt;
&lt;br /&gt;
===Method 1===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.70 - 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter the answer of a question with another answer, you can use this workaround.&lt;br /&gt;
&lt;br /&gt;
First, use answer code like that: XX for the first question, and XXYYY for the second one.&lt;br /&gt;
&lt;br /&gt;
Answer of the second question filter if the 2 first letters are the answer of the first question.&lt;br /&gt;
&lt;br /&gt;
We use 1000X1X1 and 1000X1X2 for the example, question had to be on separate page (question by question for example).The second question had to be a dropdown list (we can do similar workaround, but droplis is the best). You can do this using JQuery.  It leaves the answer in the select box, but disables it.  You could also replace &amp;quot;disable&amp;quot; with &amp;quot;remove&amp;quot; to get rid of it altogether.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var previousQuestionAnswer = &amp;quot;{INSERTANS:1000X1X1}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
var currentQuestionID = &amp;quot;#answer1000X1X1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // See if the answer for the previous question matches an answer in the current question&lt;br /&gt;
&lt;br /&gt;
   // (other than &#039;No Answer&#039;)&lt;br /&gt;
&lt;br /&gt;
   // If so, disable it.&lt;br /&gt;
&lt;br /&gt;
   if (previousQuestionAnswer!=&#039;No Answer&#039;) {&lt;br /&gt;
&lt;br /&gt;
       $(currentQuestionID).children().each(function(index, Element)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           if ($(this).attr(&#039;text&#039;) == previousQuestionAnswer)&lt;br /&gt;
&lt;br /&gt;
               { $(this).attr(&#039;disabled&#039;, true); }&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       );}&lt;br /&gt;
&lt;br /&gt;
}); // End of JQuery ready function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method 2===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with 1.92 + Firefox 9.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have a country, state, and city set of questions (or similar), you could code answer options as:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q1 Country&#039;&#039;&#039; &#039;&#039;Single choice list (ratio, dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
X country#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q2 State&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XY state#&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q3 City&#039;&#039;&#039; &#039;&#039;Single choice list (dropdown)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
XYZZ city#&lt;br /&gt;
&lt;br /&gt;
Now you must put the following Javascript code in the source of question 2 (State):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the countryCode (first character of the country)&lt;br /&gt;
       var countryCode = &#039;{INSERTANS:1000X1X1}&#039;.substr(0, 1).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the countryCode&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 1).toUpperCase() != countryCode) {&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
           }&lt;br /&gt;
       });&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the following code in the source of question 3 (City):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Get the stateCode (two first characters of the state)&lt;br /&gt;
&lt;br /&gt;
       var stateCode = &#039;{INSERTANS:1000X1X2}&#039;.substr(0, 2).toUpperCase();&lt;br /&gt;
&lt;br /&gt;
       // Loop through all dropdown options and remove those with codes not starting with the stateCode&lt;br /&gt;
&lt;br /&gt;
       $(&#039;select[id^=&amp;quot;answer&amp;quot;] option&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
           if($(this).attr(&#039;value&#039;)  &amp;amp;&amp;amp; $(this).attr(&#039;value&#039;).substr(0, 2).toUpperCase() != stateCode) {&lt;br /&gt;
&lt;br /&gt;
               $(this).remove();&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
       });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question must be in different pages of survey to work, i.e. in a question by question survey, or in diferent groups in a group by group survey.&lt;br /&gt;
&lt;br /&gt;
Note that if you choose a two characters answer option code in the State question, i.e. a XYY answer option code, you must change the &#039;&#039;substr(0, 2)&#039;&#039; part of code in question 3 to &#039;&#039;substr(0, 3)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=Filter answers of a multiple numeric type question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the the array_filter attribute, or relevance equations in general.  In 1.92, array_filter works with all questions that have sub-questions (e.g. also works for multiple numeric and multiple short text).&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to filter a question of type &amp;quot;multiple numeric&amp;quot;, you have to modify the workaround.&lt;br /&gt;
&lt;br /&gt;
Note that this workaround assumes that the code for each of the subquestions are a numeric sequence 1,2,3...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
   // Match elements with labels using htmlFor and a loop&lt;br /&gt;
&lt;br /&gt;
   var labels = document.getElementsByTagName(&#039;LABEL&#039;);&lt;br /&gt;
&lt;br /&gt;
   for (var i = 0; i &amp;lt; labels.length; i++) {&lt;br /&gt;
&lt;br /&gt;
       if (labels[i].htmlFor != &#039;&#039;) {&lt;br /&gt;
&lt;br /&gt;
            var elem = document.getElementById(labels[i].htmlFor);&lt;br /&gt;
&lt;br /&gt;
            if (elem)&lt;br /&gt;
&lt;br /&gt;
               elem.label = labels[i];&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   var answerFilter=&amp;quot;{INSERTANS:96553X63X759}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
   for (i=0; i&amp;lt;30; i++){&lt;br /&gt;
&lt;br /&gt;
     var iLabel = document.getElementById(&#039;answer96553X63X760&#039;+(i+1]].label.innerHTML;&lt;br /&gt;
&lt;br /&gt;
     if (answerFilter.search(iLabel) == -1){&lt;br /&gt;
&lt;br /&gt;
       // Hide element&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#question760&#039;).find(&#039;li&#039;).eq(i).hide();&lt;br /&gt;
&lt;br /&gt;
       // Set value of hidden elements to zero&lt;br /&gt;
&lt;br /&gt;
       document.getElementById(&#039;answer96553X63X760&#039;+(i+1)).value = 0;&lt;br /&gt;
&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
 });&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use an answer to prefill another question (default value)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.72&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;And tested with: 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do using the enhanced defaults feature, which lets you pre-fill most question types with default values.  In 1.91, you could set defaults for list and multiple choice questions.  In 1.92, you can set defaults for any text-entry question too.  Moreover, the defaults can be [[Expression Manager|Expression Manager]] compatible equations or tailored text.  Finally, with 1.92, defaults are properly managed even when set on the same page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround gives you the ablility to use an answer to fill the default value for another question. It&#039;s explained for free text question type but can be adapted for another question type.&lt;br /&gt;
&lt;br /&gt;
We use SGQA identifier. For example, we use SGQA 1000X10X20 and 1000X10X21 to prefill 1000X11X30 and 1000X11X31. For the script to work, the question has to be on a different page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X30&#039;).val(&#039;{INSERTANS:1000X10X20}&#039;);&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X11X31&#039;).val(&#039;{INSERTANS:1000X10X21}&#039;);&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want use two times the value of an integer input, you can also use this to prefill a question that you hide via CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
 $(&#039;#answer1000X2X2&#039;).val(parseInt(&#039;{INSERTANS:1000X1X1}&#039;)*2);&lt;br /&gt;
&lt;br /&gt;
 $(&amp;quot;#question2&amp;quot;).hide();&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can use {INSERTANS:1000X2X2} for giving you twice the value of the user input from question 1.&lt;br /&gt;
&lt;br /&gt;
=Dynamic Sum=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, this is easier to do with [[Expression Manager|Expression Manager]] using the sum() function.  Not only will sums be dynamic, but they wille exclude irrelevant values, so you can array_filter a multiple numeric question and get the sum of just the answers that are visible.  This [[Expression Manager HowTos#Calculate assessment values at runtime and store the results in the survey data|HowTo example]] demonstrates the dynamic sum feature.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;Also note, as of version 1.92, the following workaround will fail, since it includes a a regular expression containing curly braces.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script is used with a &amp;quot;Multiple Options&amp;quot; type question calculate a total price based on how which checkboxes are selected. The prices are listed as part of the answer. The answers are set up like this: &amp;quot;USB Mouse ($20)&amp;quot;. The script uses the number between the &amp;quot;($&amp;quot; and the &amp;quot;)&amp;quot; as the price for that item. You can adapt the script to if you need to change the currency or need to sum something other than money.&lt;br /&gt;
&lt;br /&gt;
This script works when used in a question-by-question format.  It does not work when there are more than one question on a page. I think it can be adapted to work, but I haven&#039;t done the coding yet.&lt;br /&gt;
&lt;br /&gt;
Put the following code into body of your question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script language=Javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// General definitions&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match the labels containing information about an answer&lt;br /&gt;
&lt;br /&gt;
// In LimeSurvey, these labels start with &amp;quot;answer...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
var answerRegex = /^answer/;&lt;br /&gt;
&lt;br /&gt;
// Find all answer checkboxes in the document and set their&lt;br /&gt;
&lt;br /&gt;
// onchange events to updatePrice&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   // Find all input elements&lt;br /&gt;
&lt;br /&gt;
   var inputList=document.getElementsByTagName(&amp;quot;input&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   // Loop through each, looking for checkboxes&lt;br /&gt;
&lt;br /&gt;
   var i;&lt;br /&gt;
&lt;br /&gt;
   for( i=0; i&amp;lt; inputList.length;i++ )&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // If input item does not have an ID, skip&lt;br /&gt;
&lt;br /&gt;
       if (! (inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if ID doesn&#039;t start with &amp;quot;answer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       if (!answerRegex.test(inputList[i].id)) { continue; }&lt;br /&gt;
&lt;br /&gt;
       // Skip to next if not a checkbox&lt;br /&gt;
&lt;br /&gt;
       if (inputList[i].type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
       // This is an answer checkbox!&lt;br /&gt;
&lt;br /&gt;
       // Setup onchange event&lt;br /&gt;
&lt;br /&gt;
       inputList[i].onclick = updatePrice;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
       // Load initial sum&lt;br /&gt;
&lt;br /&gt;
   updatePrice();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function updatePrice()&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
var labels=document.getElementsByTagName(&amp;quot;LABEL&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Define a regular expression to match a price inside parenthesis&lt;br /&gt;
&lt;br /&gt;
// For example: ($29) or ($29.54).&lt;br /&gt;
&lt;br /&gt;
// Set up&lt;br /&gt;
&lt;br /&gt;
priceRegex = /\(\$(\d*\.{0,1}\d+)\)/;&lt;br /&gt;
&lt;br /&gt;
// Loop through all the labels, looking for labels corresponding to&lt;br /&gt;
&lt;br /&gt;
// answers that have a price in them.&lt;br /&gt;
&lt;br /&gt;
var i;&lt;br /&gt;
&lt;br /&gt;
var total = 0;&lt;br /&gt;
&lt;br /&gt;
for( i=0; i&amp;lt;labels.length;i++ )&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   var myArray;    // Define array used for regex matching&lt;br /&gt;
&lt;br /&gt;
   var inputID;    // Define field element&lt;br /&gt;
&lt;br /&gt;
   // Get the ID of the field corresponding to the label using the&lt;br /&gt;
&lt;br /&gt;
   // &amp;quot;htmlFor&amp;quot; attribute&lt;br /&gt;
&lt;br /&gt;
   // (FYI, there are some labels that will have to be screened out&lt;br /&gt;
&lt;br /&gt;
   // because they don&#039;t correspond to an answer)&lt;br /&gt;
&lt;br /&gt;
   // Does the label start with &amp;quot;answer&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
   // If not: exit.&lt;br /&gt;
&lt;br /&gt;
   if (!answerRegex.test(labels[i].htmlFor)) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // First make sure this element exists&lt;br /&gt;
&lt;br /&gt;
   // If it doesn&#039;t, go to the next element&lt;br /&gt;
&lt;br /&gt;
   // If it does, it will be defined in inputID&lt;br /&gt;
&lt;br /&gt;
   if (! (inputID = document.getElementById(labels[i].htmlFor)) ) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // See if the corresponding answer is a checkbox that is checked.&lt;br /&gt;
&lt;br /&gt;
   // If not, go to next label&lt;br /&gt;
&lt;br /&gt;
   if (inputID.type.toUpperCase()!=&#039;CHECKBOX&#039;)  { continue; }&lt;br /&gt;
&lt;br /&gt;
   if (!inputID.checked) { continue; }&lt;br /&gt;
&lt;br /&gt;
   // This is label for an answer.&lt;br /&gt;
&lt;br /&gt;
   // The innerHTML will give us the text of the label&lt;br /&gt;
&lt;br /&gt;
   // The price information will be in the form ($XX.XX)&lt;br /&gt;
&lt;br /&gt;
   // which in contained in the label text.&lt;br /&gt;
&lt;br /&gt;
   // Find a match for a decimal number inside the pattern &amp;quot;($&amp;quot; and &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   if [[myArray = priceRegex.exec(labels[i].innerHTML]] != null)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       // Keep a running tally&lt;br /&gt;
&lt;br /&gt;
       total += parseFloat(myArray[1]);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
  // Update total price on form&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&amp;quot;totalPrice&amp;quot;).value = &amp;quot;$&amp;quot; + formatCurrency(total);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function formatCurrency(num) {&lt;br /&gt;
&lt;br /&gt;
  num = isNaN(num) || num &amp;lt;u&amp;gt; &#039;&#039; || num &amp;lt;/u&amp;gt; null ? 0.00 : num;&lt;br /&gt;
&lt;br /&gt;
  return parseFloat(num).toFixed(2);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the following code in the help section (or wherever you want the sum to appear):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Total Cost for selected accessories: &amp;lt;input type=&amp;quot;readonly&amp;quot; value=&amp;quot;&amp;quot; id=&amp;quot;totalPrice&amp;quot; /&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Focus on the first Input field=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: LimeSurvey 1.80 / IE6/7, Firefox 3, Safari, Opera, chrome&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, there is a built-in JavaScript function called  focusFirst() to focus on the first visible element.  It uses jQuery, so is more robust than this example.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again an onload Function is needed for this tasks. I have done it the DOM way with compatibility to IE6/7.&lt;br /&gt;
&lt;br /&gt;
Put the following code into the startpage.pstpl of your template, right before the &amp;lt;/head&amp;gt; closing tag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   function focusFirst(Event)&lt;br /&gt;
&lt;br /&gt;
   {&lt;br /&gt;
&lt;br /&gt;
       var i=0;&lt;br /&gt;
&lt;br /&gt;
       while(document.forms[0].elements[i].type == &amp;quot;hidden&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           i++;&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       document.forms[0].elements[i].focus();&lt;br /&gt;
&lt;br /&gt;
       return;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if(ie)&lt;br /&gt;
&lt;br /&gt;
   { window.attachEvent(&amp;quot;onload&amp;quot;, focusFirst); }&lt;br /&gt;
&lt;br /&gt;
   else&lt;br /&gt;
&lt;br /&gt;
   { document.addEventListener(&amp;quot;load&amp;quot;, focusFirst, true); }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; I am using this with version 1.80. As changes happened to the templates in the last release, you might need to add the following before the code, if your template is older than 1.80 stable and does not include this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   var ie = false;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need this for the var ie to be set. Without this var, the function will not work with ie.&lt;br /&gt;
&lt;br /&gt;
=Answer questions by keypress=&lt;br /&gt;
&lt;br /&gt;
(&#039;&#039;Tested with: IE7, Firefox 3&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
This workaround allow to answer the question on key 0-9 (0 is for the 10 answer).&lt;br /&gt;
&lt;br /&gt;
Follow issues are supported at the moment:&lt;br /&gt;
*Yes-No Questions&lt;br /&gt;
*List Questions (radio)&lt;br /&gt;
*other radio questions&lt;br /&gt;
&lt;br /&gt;
In lists the answer limit is ten.&lt;br /&gt;
&lt;br /&gt;
You supply the template &amp;quot;endpage&amp;quot; of your template with the following script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   jQuery(document).bind(&#039;keypress&#039;, function(e){&lt;br /&gt;
&lt;br /&gt;
       if (48 &amp;lt;= e.which &amp;amp;&amp;amp; e.which &amp;lt;= 57) {&lt;br /&gt;
&lt;br /&gt;
           jQuery(&#039;input:radio&#039;).each(function() {&lt;br /&gt;
&lt;br /&gt;
               var v = jQuery(this).val();&lt;br /&gt;
&lt;br /&gt;
               var c = (e.which &amp;lt;u&amp;gt; 48) ? 10 : e.which - 48;&lt;br /&gt;
&lt;br /&gt;
               if(v &amp;lt;/u&amp;gt; &#039;Y&#039; || v &amp;lt;u&amp;gt; &#039;N&#039;) {&lt;br /&gt;
&lt;br /&gt;
                   v = (v &amp;lt;/u&amp;gt; &#039;Y&#039;) ? 1 : 2;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               if(v == c) {&lt;br /&gt;
&lt;br /&gt;
                   jQuery(this).click();&lt;br /&gt;
&lt;br /&gt;
                   jQuery(&#039;#limesurvey input:submit&#039;).click();&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   })&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Math notation in LimeSurvey=&lt;br /&gt;
#download the js file from [http://mathcs.chapman.edu/~jipsen/mathml/asciimathdownload.html AsciiMath script]&lt;br /&gt;
#copy it in the /scripts/ folder in your installation&lt;br /&gt;
#modify the startpage.psptl of the template you want to use adding the reference to the script (if you use an older version make sure that you copy the template folder first!) for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;ASCIIMathML.js&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use the notation where you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use internet explorer or safari you will need to download the plugin as well, but firefox does the lot for you.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are confident with the limesurvey structure you could add the editor which support math notation and change the reference to the editor you want to use in the configuration file. here is the [http://www.imathas.com/editordemo/demo.html link for a TinyMCE with math support].&lt;br /&gt;
&lt;br /&gt;
=Filter &amp;quot;Array by Column&amp;quot; Question With &amp;quot;Multiple-Options&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 2.06 this workaround is not required. It can be handled with sub-question relevance.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround applies a filter to an &amp;quot;Array by Column&amp;quot; question based on the checked boxes of a previous multiple-options question. There are two methods - one for filter and array questions being on the same page and a slightly different one for the filter question being on a page before the array question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH METHODS:&#039;&#039;&#039;&lt;br /&gt;
*[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
*If using LimeSurvey version 2.05 or newer, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
&lt;br /&gt;
	// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
	if(prevPage == 1) {&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
		classArr = classArr[1].split(&#039; &#039;);&lt;br /&gt;
		var ansCode = classArr[0];&lt;br /&gt;
		$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Assign classes to the answer label cells&lt;br /&gt;
	$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody tr:eq(0) td.answer-item&#039;).each(function(i){&lt;br /&gt;
		var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
		var ansCode2 = classArr2[1];&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// Fire the filter function on page load&lt;br /&gt;
	filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
	// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
	$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
	});&lt;br /&gt;
	   &lt;br /&gt;
	// On submit, clear all hidden radios of array&lt;br /&gt;
	$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).prop(&#039;checked&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
		return true;&lt;br /&gt;
	});&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
&lt;br /&gt;
	if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
		// Hide the array if no multi-opt options are checked&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
	   &lt;br /&gt;
		// Hide all columns of array&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.subquestions-list tbody td.answer-item, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
	   &lt;br /&gt;
		// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
			if($(this).prop(&#039;checked&#039;) == true) {&lt;br /&gt;
				var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
				var ansCode3 = classArr3[1];&lt;br /&gt;
				$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If using LimeSurvey version 2.0 or older, place the following functions in your template.js file. These will be accessed by either method.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
	function filterArrByCol(qMultiOpt, qArray, prevPage) {&lt;br /&gt;
	&lt;br /&gt;
		// If filter question is on a previous page, hide Q1 and check all &amp;quot;visible&amp;quot; boxes&lt;br /&gt;
		if(prevPage == 1) {&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; li[id^=&amp;quot;javatbd&amp;quot;]:visible input.checkbox&#039;).attr(&#039;checked&#039;, true);&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody td&#039;).each(function(i){&lt;br /&gt;
			var classArr = $(this).attr(&#039;class&#039;).split(&#039;answer_cell_00&#039;);&lt;br /&gt;
			var ansCode = classArr[1];&lt;br /&gt;
			$(this).addClass(&#039;ans-&#039;+ansCode+&#039; filtered&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Assign classes to the answer label cells&lt;br /&gt;
		$(&#039;#question&#039;+qArray+&#039; table.question tbody tr:eq(0) td&#039;).each(function(i){&lt;br /&gt;
			var classArr2 = $(this).attr(&#039;class&#039;).split(&#039; ans-&#039;);&lt;br /&gt;
			var ansCode2 = classArr2[1];&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question thead tr:eq(0) th:eq(&#039;+i+&#039;)&#039;).addClass(&#039;ans-&#039;+ansCode2+&#039;&#039;);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Fire the filter function on page load&lt;br /&gt;
		filterArr(qMultiOpt, qArray);&lt;br /&gt;
&lt;br /&gt;
		// Listener on multi-opt checkboxes to fire the filter function&lt;br /&gt;
		$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).click(function(){&lt;br /&gt;
			filterArr(qMultiOpt, qArray);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// On submit, clear all hidden radios of array&lt;br /&gt;
		$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; td.filtered:hidden&#039;).each(function(i){&lt;br /&gt;
				$(&#039;input.radio&#039;, this).attr(&#039;checked&#039;, false);&lt;br /&gt;
			});&lt;br /&gt;
			return true;&lt;br /&gt;
		});&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	function filterArr(qMultiOpt, qArray) {&lt;br /&gt;
	&lt;br /&gt;
		if($(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox:checked&#039;).length &amp;lt; 1) {&lt;br /&gt;
			// Hide the array if no multi-opt options are checked&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).hide();&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039;&#039;).show();&lt;br /&gt;
			&lt;br /&gt;
			// Hide all columns of array&lt;br /&gt;
			$(&#039;#question&#039;+qArray+&#039; table.question tbody td, #question&#039;+qArray+&#039; table.question thead th&#039;).hide();&lt;br /&gt;
			&lt;br /&gt;
			// Loop through multi-opt checkboxes and, if checked, show corresponding column of array&lt;br /&gt;
			$(&#039;#question&#039;+qMultiOpt+&#039; input.checkbox&#039;).each(function(i){&lt;br /&gt;
				if($(this).attr(&#039;checked&#039;) == true) {&lt;br /&gt;
					var classArr3 = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qMultiOpt);&lt;br /&gt;
					var ansCode3 = classArr3[1];&lt;br /&gt;
					$(&#039;#question&#039;+qArray+&#039; .ans-&#039;+ansCode3+&#039;&#039;).show();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR BOTH FILTER AND ARRAY QUESTIONS ON SAME PAGE:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question and an array-by-column question on the same page (in the same group).&lt;br /&gt;
*Both questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Place the following script in the source of one of the questions.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the ranking question.&lt;br /&gt;
*The function will hide the array question unless at least one option is selected in the multiple-options question, in which case, it will only show the corresponding array column(s).&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR FILTER AND ARRAY QUESTIONS ON SEPARATE PAGES:&#039;&#039;&#039;&lt;br /&gt;
*Create a multiple options question on page 1.&lt;br /&gt;
*Create a multiple options question and an array-by-column question on page 2.&lt;br /&gt;
*All three questions &#039;&#039;&#039;MUST&#039;&#039;&#039; have identical sub-questions and sub-question codes.&lt;br /&gt;
*Set the multiple options on page 2 to be filtered by the multiple options on page 1.&lt;br /&gt;
*Place the following script in the source of one of the questions on page 2.&lt;br /&gt;
*Replace &amp;quot;MM&amp;quot; with the ID of the multiple options question and &amp;quot;AA&amp;quot; with the ID of the array question. Do not modify the &amp;quot;1&amp;quot;.&lt;br /&gt;
*The function will hide the multiple options question. If options were selected in the multiple options on page 1, the corresponding options will be checked in the hidden multiple options question which will then be used to control the display of the array columns.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		filterArrByCol(MM, AA, 1);&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Auto-tabbing between text input fields=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a workaround to facilitate auto-tabbing between text input questions in a single group using a [http://plugins.jquery.com/project/autotab jQuery plugin by Mathachew] and the Maximum characters attribute of questions.&lt;br /&gt;
&lt;br /&gt;
The behaviour will be: When the maximum number of characters has been entered into an input field, the focus (cursor) will be automatically moved to the next input field. When the backspace key is used to remove all characters from a field, the focus will be moved to the previous field. It&#039;s very useful in surveys having many text input questions to avoid having to manually tab or click between fields.&lt;br /&gt;
&lt;br /&gt;
You can view a small demo survey [http://www.partnersinc.biz/surveys//index.php?sid=11327&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Visit [http://plugins.jquery.com/autotabs http://plugins.jquery.com/autotabs], download the plugin script and save it as &#039;&#039;jquery.autotab-1.1b.js&#039;&#039; in the template folder.&lt;br /&gt;
#Link to the script by placing &#039;&#039;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.autotab-1.1b.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&#039;&#039; within the &#039;&#039;&amp;lt;head&amp;gt;&#039;&#039; tag of startpage.pstpl.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create the text based questions that auto-tabbing is to be applied to. (All must be in the same group if you&#039;re using group by group presentation)&lt;br /&gt;
#Define a Maximum characters attribute for all questions that the autotab is applied to.&lt;br /&gt;
{{QS:maximum_chars}}  &lt;br /&gt;
#In the source of the first question of the group that contains the auto-tabbed questions, add the following code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).focus(); //initially focus on the first input&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXAA&#039;).autotab({ target: &#039;answerSSSSSXGGXBB&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXBB&#039;).autotab({ previous: &#039;answerSSSSSXGGXAA&#039;, target: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXCC&#039;).autotab({ previous: &#039;answerSSSSSXGGXBB&#039;, target: &#039;answerSSSSSXGGXDD&#039; });&lt;br /&gt;
&lt;br /&gt;
       $(&#039;#answerSSSSSXGGXDD&#039;).autotab({ previous: &#039;answerSSSSSXGGXCC&#039; });&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has 4 fields to be auto-tabbed between - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
*SSSSS -&amp;gt; Survey ID&lt;br /&gt;
*GG -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Last question&lt;br /&gt;
&lt;br /&gt;
[[File:ids_343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;target&#039;&#039; parameter defines where the next input is and the &#039;&#039;previous&#039;&#039; parameter defines (you guessed it) the previous input.&lt;br /&gt;
&lt;br /&gt;
This plugin also has limited capability of formatting the input text - see comments in the plugin script.&lt;br /&gt;
&lt;br /&gt;
=Custom response listeners=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.85+ (7253), IE 6/7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Listeners can be used to perform functions when a change in an input is detected. There are many uses such as the [[Workarounds#Reverse_array_filter|Reverse array_filter]] but a simple one would be to warn a respondent if they enter a value that may be too high.&lt;br /&gt;
&lt;br /&gt;
We can use the [http://docs.jquery.com/Events/change jQuery change( ) event] to fire a function whenever there is a change to the input. The function will look for an input value higher than 10 and, if found, will warn the respondent.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page where:&lt;br /&gt;
**11111 is the survey ID&lt;br /&gt;
**22 is the group ID&lt;br /&gt;
**33 is the question ID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer11111X22X33&#039;).change(function() {&lt;br /&gt;
&lt;br /&gt;
			if ( $(&#039;#answer11111X22X33&#039;).val() &amp;gt; 10 ) {&lt;br /&gt;
				alert (&amp;quot;That&#039;s an awful lot. Are you sure?&amp;quot;);&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Text input masks=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7, FireFox 3.0, Safari 3.2, Chrome 2.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a Canadian postal code (A1A 1A1) The [http://plugins.jquery.com/project/meioMask jQuery meioMask plugin by fabiomcosta] can be used to do this.&lt;br /&gt;
&lt;br /&gt;
The plugin has several pre-defined masks and supports custom masks. It also allows for pasting of input, allows default values and can auto-focus the next form element when the current input is completely filled. See [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
There is a small demo [http://www.partnersinc.biz/surveys//index.php?sid=36146&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
Implementation for this demo was as follows:&lt;br /&gt;
#Visit [http://www.meiocodigo.com/projects/meiomask/ http://www.meiocodigo.com/projects/meiomask/], download the latest plugin script and save it as jquery.meiomask.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.meiomask.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here]) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {	&lt;br /&gt;
						   &lt;br /&gt;
	// Define custom masks&lt;br /&gt;
	$.mask.masks = $.extend($.mask.masks,{&lt;br /&gt;
		customMask1:{ mask: &#039;a9a 9a9&#039; }, // Canadian postal code&lt;br /&gt;
		// Maximum input of 9,999.99, reverse input, default value of 0.00		&lt;br /&gt;
		customMask2:{ mask: &#039;99.999,9&#039;, type : &#039;reverse&#039;, defaultValue : &#039;000&#039; } &lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// Set the &#039;alt&#039; attributes of the inputs&lt;br /&gt;
	$(&#039;#answer111111X22XAA&#039;).attr(&#039;alt&#039;, &#039;phone-us&#039;); // a pre-defined mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XBB&#039;).attr(&#039;alt&#039;, &#039;customMask1&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XCC&#039;).attr(&#039;alt&#039;, &#039;customMask2&#039;); // a custom mask					   &lt;br /&gt;
	$(&#039;#answer111111X22XDD&#039;).attr(&#039;alt&#039;, &#039;cc&#039;); // a pre-defined mask for credit card&lt;br /&gt;
	&lt;br /&gt;
	// Tell the plugin to apply masks to these inputs&lt;br /&gt;
	$(&#039;input:#answer111111X22XAA&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XBB&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XCC&#039;).setMask();&lt;br /&gt;
	$(&#039;input:#answer111111X22XDD&#039;).setMask();	&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first section defines two custom masks to be used - one for Canadian postal code with a format of A#A #A# and a second for a maximum amount of 9999.99 with reverse input (useful for cost inputs) and a default value of 0.00.&lt;br /&gt;
&lt;br /&gt;
The next section sets the &amp;quot;alt&amp;quot; attributes for the text inputs. This will tell meioMask which mask we will be applying to each input. By default meioMask looks at the alt attribute to find which mask to apply however this can be changed using the [http://www.meiocodigo.com/projects/meiomask/#mm_options mask options].&lt;br /&gt;
&lt;br /&gt;
In the final section we apply the masks to the inputs.&lt;br /&gt;
&lt;br /&gt;
This example has 4 inputs with masks on them - all instances of the following must be replaced to be compatible with your survey (See image below):&lt;br /&gt;
&lt;br /&gt;
*11111 -&amp;gt; Survey ID&lt;br /&gt;
*22 -&amp;gt; Group ID&lt;br /&gt;
*AA -&amp;gt; First question&lt;br /&gt;
*BB -&amp;gt; Second question&lt;br /&gt;
*CC -&amp;gt; Third question&lt;br /&gt;
*DD -&amp;gt; Fourth question&lt;br /&gt;
&lt;br /&gt;
[[File:Ids 343x252.gif]]&lt;br /&gt;
&lt;br /&gt;
=Text input masks - second method=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91RC6+, FireFox 4.0&#039;&#039;&lt;br /&gt;
&#039;&#039;Tested with: 2.05, Chrome 40.0.2214.115 m (64-bit)&lt;br /&gt;
&lt;br /&gt;
There may be instances where you would like to place a mask on a text input - for example only allowing respondents to enter the correct characters for a North American phone number ((###) ###-####) or a US social security number (###-##-####). The jQuery meioMask plugin by fabiomcosta is no longer supported but an alternative exists. The DigitalBush Masked Input Plugin is updated and simple to implement in LimeSurvey. See [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/] for more details on features and options.&lt;br /&gt;
&lt;br /&gt;
Implementation as follows:&lt;br /&gt;
&lt;br /&gt;
#Visit [http://digitalbush.com/projects/masked-input-plugin/ http://digitalbush.com/projects/masked-input-plugin/], download the latest plugin script and save it as jquery.maskedinput.js in the template folder.&lt;br /&gt;
#Link to the script by placing &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.maskedinput.js&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt; within the &amp;lt;head&amp;gt; tag of startpage.pstpl.&lt;br /&gt;
#Turn off $filterxsshtml to allow insertion of JavaScript in the questions. ([http://docs.limesurvey.org/tiki-index.php?page=Optional+settings&amp;amp;structure=English+Instructions+for+LimeSurvey#Filtering_dangerous_HTML_tags_in_survey_objects See documentation here])&lt;br /&gt;
#Create the text input questions that the masks are to be applied to&lt;br /&gt;
#In the source of the help section of the first question of the group that contains the masked inputs, add the following code. ([http://docs.limesurvey.org/tiki-index.php?page=Workarounds&amp;amp;structure=English+Instructions+for+LimeSurvey#How_to_use_Script_eg._JavaScript_etc._ See How to use script here])  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function($) {	 &lt;br /&gt;
		$(&amp;quot;#answer55431X1X5&amp;quot;).mask(&amp;quot;999-99-9999&amp;quot;,{ placeholder:&amp;quot;#&amp;quot; });&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace the &amp;quot;#answer55431X1X5&amp;quot; with your survey ID, group ID, and question ID. You can change the mask format and change or eliminate the placeholder if you wish. If you have multiple questions in the same group, simply copy and paste the line that begins with &amp;quot;$&amp;quot; and change the code to what is needed for your application.&lt;br /&gt;
&lt;br /&gt;
=Select a random response to a &amp;quot;Multiple options&amp;quot; question for later use=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to randomly select one of the checked boxes in a &amp;quot;Multiple options&amp;quot; question and store it&#039;s label for later use in the survey. A possible use-case would be to have a question asking what products were purchased and then randomly selecting one of the products to ask further questions about.&lt;br /&gt;
&lt;br /&gt;
The workaround puts a listener on the checkboxes that loops through all of the checked boxes and adds their labels to an array. A random item is pulled from the array and loaded into the hidden question. This hidden question can then be used in Expression Manager equations, relevance or conditions.&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DOWNLOAD:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v206.1.zip|Demo survey for LS 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Random_Option_From_Multi-Choice_v25.1.zip|Demo survey for LS 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.06)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#[https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey.3F Set up your survey to use JavaScript].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question&lt;br /&gt;
#Immediately following that question, create a short-text question to store the label of the checked box in (we&#039;ll hide this with JavaScript)&lt;br /&gt;
#Place the script below in the source of the multiple options question. &amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.other-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($(this).nextAll(&#039;label:eq(0)&#039;).text());&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 3 implementation steps above&lt;br /&gt;
#Place the script below in the source of the multiple options question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function() {	&lt;br /&gt;
 &lt;br /&gt;
		// Identify the questions&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		var qHidden = thisQuestion.nextAll(&#039;.text-short:eq(0)&#039;);&lt;br /&gt;
		var hiddenInput = $(&#039;input.text&#039;, qHidden);&lt;br /&gt;
		&lt;br /&gt;
		// Hide qHidden&lt;br /&gt;
		qHidden.hide();&lt;br /&gt;
		&lt;br /&gt;
		// Class for &amp;quot;Other&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).closest(&#039;.answer-item&#039;).addClass(&#039;other-item&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the checkboxes&lt;br /&gt;
		$(&#039;input.checkbox&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			handleChecked();&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Listener on the &amp;quot;Other&amp;quot; input&lt;br /&gt;
		$(&#039;input.text&#039;, thisQuestion).on(&#039;keyup change&#039;, function(e) {&lt;br /&gt;
			setTimeout(function() {&lt;br /&gt;
				handleChecked();&lt;br /&gt;
			}, 250);&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleChecked() {&lt;br /&gt;
			// Build an array of checked answers&lt;br /&gt;
			var checkedAnswers = [];&lt;br /&gt;
			$(&#039;input.checkbox:checked&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				if($(this).closest(&#039;.answer-item&#039;).hasClass(&#039;other-item&#039;)) {&lt;br /&gt;
					checkedAnswers.push($(this).closest(&#039;.answer-item&#039;).find(&#039;input.text&#039;).val());&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					checkedAnswers.push($.trim($(this).nextAll(&#039;.label-text:eq(0)&#039;).text()));&lt;br /&gt;
				}				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Load the hidden question with a random item from the array&lt;br /&gt;
			var checkedLength = checkedAnswers.length;&lt;br /&gt;
			$(hiddenInput).val(checkedAnswers[Math.floor(Math.random()*checkedLength)]);&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type);&lt;br /&gt;
		}&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Display secondary options in a &amp;quot;Multiple options&amp;quot; question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey versions 2.06 and 2.5, IE 7-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to display secondary options in a &amp;quot;Multiple options&amp;quot; question if a primary option is checked as in the images below.&lt;br /&gt;
&lt;br /&gt;
Primary option not selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Primary option selected:&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Secondary_options_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.zip|Demo template for LS version 2.06]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Demo_Secondary_Checkboxes.lss|Demo survey for LS version 2.06]].&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Template_Demo_Secondary_Checkboxes_For_2.5.zip|Demo template for LS version 2.5]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Survey_Demo_Secondary_Multiple_Options_For_LS_25.zip|Demo survey for LS version 2.5]].&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.06)&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create a &amp;quot;Multiple options&amp;quot; question including both the primary and secondary sub-questions (in the order that you would like them displayed if all shown).&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var primaryRow = $(&#039;li.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;li.question-item:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039; (LimeSurvey version 2.5)&lt;br /&gt;
&lt;br /&gt;
#Follow the first 2 implementation steps above&lt;br /&gt;
#Add the following function to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A function to handle &amp;quot;secondary&amp;quot; checkboxes&lt;br /&gt;
function secondaryCheckboxes(qID, primaryPosition, secondaryCount) {&lt;br /&gt;
	// Identify the elements&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	$(&#039;div.question-item&#039;, thisQuestion).parent().addClass(&#039;answer-row&#039;);&lt;br /&gt;
	var primaryRow = $(&#039;div.question-item:eq(&#039;+(primaryPosition-1)+&#039;)&#039;, thisQuestion).closest(&#039;.answer-row&#039;);&lt;br /&gt;
	var primaryInput = $(&#039;input.checkbox&#039;, primaryRow);&lt;br /&gt;
	var secondaryRows = primaryRow.nextAll(&#039;div.answer-row:lt(&#039;+(secondaryCount)+&#039;)&#039;);&lt;br /&gt;
	var secondaryInputs = $(&#039;input.checkbox&#039;, secondaryRows);&lt;br /&gt;
	&lt;br /&gt;
	// Indent the secondaries&lt;br /&gt;
	secondaryRows.css({ &#039;margin-left&#039;:&#039;2.5em&#039; });&lt;br /&gt;
	&lt;br /&gt;
	// Initial states of the secondary answers&lt;br /&gt;
	if (primaryInput.prop(&#039;checked&#039;) == false ) {&lt;br /&gt;
		secondaryRows.hide(); &lt;br /&gt;
	} &lt;br /&gt;
	&lt;br /&gt;
	// A listener on the primary answer to show or hide secondary answers &lt;br /&gt;
	primaryInput.click(function (event) { &lt;br /&gt;
		&lt;br /&gt;
		// Hide/show the secondary answers accordingly&lt;br /&gt;
		if (!$(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
			secondaryRows.hide();				&lt;br /&gt;
			secondaryInputs.prop(&#039;checked&#039;, false);&lt;br /&gt;
			secondaryInputs.each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			secondaryRows.show(); &lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Call the function in the source of the question with the question ID (no editing necessary), the start position of the primary sub-question and the number of secondaries to follow. &amp;lt;br /&amp;gt;So, in this example, sub-question 1 is a primary followed by 2 secondaries and subquestion 6 is a primary followed by 3 secondaries.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Sub-question 1 is primary followed by 2 secondaries&lt;br /&gt;
		secondaryCheckboxes({QID}, 1, 2);&lt;br /&gt;
		// Sub-question 6 is primary followed by 3 secondaries		&lt;br /&gt;
		secondaryCheckboxes({QID}, 6, 3);&lt;br /&gt;
    });	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum elapsed time before moving forward in survey=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the amount of time elapsed since the page loaded. If the time is less than the minimum dictated, the respondent is alerted and not allowed to proceed. It is useful if you want to enforce a minimum amount of time spent viewing a page.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replacing &amp;quot;TT&amp;quot; with the minimum number of seconds required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		minTime(TT);&lt;br /&gt;
&lt;br /&gt;
		function minTime(minTime) {&lt;br /&gt;
&lt;br /&gt;
			var startTime = new Date();&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
				var endTime = new Date();&lt;br /&gt;
&lt;br /&gt;
				if((endTime - startTime)/1000 &amp;lt;= minTime) {&lt;br /&gt;
					alert (&#039;You must spend at least &#039;+minTime+&#039; seconds on the question.&#039;);&lt;br /&gt;
					return false;&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Minimum number of characters in Long free text or Huge free text questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91, IE 7/8, Firefox 7.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.91, you can use regular expression masks (validation) to specify the minimum number of required characters.  However, even if the question is mandatory, it can still be blank.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version  1.92, if you make the question mandatory and use a validation mask to specify the minimum number of characters, then the user will be forced to answer the question.  Note that unlike 1.91, they can submit their current answers, even if partially invalid (so they are stored in the database), but they will not ber able to proceed to the next page until they have passed all mandatory and validity checks.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround interrupts the Next/Submit function and checks the number of characters entered in a Long free text or Huge free text question. If the number is less than the minimum dictated, the respondent is alerted and not allowed to proceed.&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
#Place the script below in the source of one of the questions on the page, replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the minimum number of characters required before advancing is allowed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       minChar(QQ, CC);&lt;br /&gt;
&lt;br /&gt;
       function minChar(qID, minChars) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               if($(&#039;#question&#039;+qID+&#039; textarea&#039;).val().replace(/ /g,&#039;&#039;).length &amp;lt; minChars) {&lt;br /&gt;
&lt;br /&gt;
                   alert (&#039;You must enter at least &#039;+minChars+&#039; characters.&#039;);&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Variable Length Array (Multi Flexible Text) question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows a respondent to add or remove rows of an Array (Multi Flexible Text) question. It&#039;s useful to avoid the page being cluttered with unnecessary array rows.&lt;br /&gt;
&lt;br /&gt;
A function is placed in the template.js file of your template (use template editor). This function hides all of the array rows except the first and inserts two elements that when clicked show or hide rows accordingly.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=53132&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
It must be noted that you can not make this question Mandatory as the respondent will have no way to complete hidden fields. If you want the displayed fields to be mandatory you will need to validate them in another function or modify this function to only allow the addition of rows if all fields in the last row are completed and then disable those fields - that, however, is a little over the top for this example.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#Set up your survey to use JavaScript (See instructions [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|here]])&lt;br /&gt;
&lt;br /&gt;
#Add the following script to your &#039;&#039;template.js&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end with the question ID.&lt;br /&gt;
&lt;br /&gt;
#Create one or more Array (Multi Flexible Text) questions&lt;br /&gt;
&lt;br /&gt;
#If you want to apply it to more arrays on the same page simply add more calls with the appropriate question IDs. (eg. varLengthArray(1); varLengthArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   // A function to add or remove rows of an Array (Multi Flexible)(Text) question&lt;br /&gt;
	function varLengthArray(qID) {&lt;br /&gt;
&lt;br /&gt;
		if ($(&#039;#question&#039;+qID+&#039;&#039;).length &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
			// The HTML content of the Add/Remove elements - modify as you wish&lt;br /&gt;
			var addContent = &#039;[+]&#039;;&lt;br /&gt;
			var removeContent = &#039;[-]&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Create the Add and Remove elements &amp;amp; insert them&lt;br /&gt;
			var el1 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el1.setAttribute(&#039;id&#039;,&#039;addButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el1);&lt;br /&gt;
			var el2 = document.createElement(&#039;div&#039;);&lt;br /&gt;
			el2.setAttribute(&#039;id&#039;,&#039;removeButton&#039;+qID);&lt;br /&gt;
			document.body.appendChild(el2);&lt;br /&gt;
&lt;br /&gt;
			// Move them to after the array&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).appendTo($( &#039;#question&#039; + qID + &#039; table.question&#039; ).parent());&lt;br /&gt;
&lt;br /&gt;
			// Insert their HTML&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).html( addContent );&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).html( removeContent );&lt;br /&gt;
&lt;br /&gt;
			// Style the elements - you can modify here if you wish&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).css({&lt;br /&gt;
				&#039;margin&#039;:&#039;10px 0 0 10px&#039;,&lt;br /&gt;
				&#039;padding&#039;:&#039;1px&#039;,&lt;br /&gt;
				&#039;text-align&#039;:&#039;center&#039;,&lt;br /&gt;
				&#039;font-weight&#039;:&#039;bold&#039;,&lt;br /&gt;
				&#039;width&#039;:&#039;auto&#039;,&lt;br /&gt;
				&#039;cursor&#039;:&#039;pointer&#039;,&lt;br /&gt;
				&#039;float&#039;:&#039;left&#039;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initially hide the Remove element&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
&lt;br /&gt;
			// Call the functions below when clicked&lt;br /&gt;
			$( &#039;div#addButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				addRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
			$( &#039;div#removeButton&#039;+qID ).click(function (event) {&lt;br /&gt;
				removeRow(qID);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row, also shows the Remove element and hides the&lt;br /&gt;
			//Add element if all rows are shown&lt;br /&gt;
			function addRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(&#039; + rowCount + &#039;)&#039; ).attr(&#039;name&#039;) == &#039;visible&#039; )  {&lt;br /&gt;
					$( &#039;div#addButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Function to remove a row, also clears the contents of the removed row,&lt;br /&gt;
			// shows the Add element if the last row is hidden and hides the Remove&lt;br /&gt;
			// element if only the first row is shown&lt;br /&gt;
			function removeRow(qID) {&lt;br /&gt;
				var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
				var rowCount = $( arrayRow ).size() - 1;&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last input[type=&amp;quot;text&amp;quot;]&#039; ).val(&#039;&#039;);&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;visible&amp;quot;]:last&#039; ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				$( &#039;div#addButton&#039;+qID ).show();&lt;br /&gt;
				if ( $( arrayRow + &#039;:eq(1)&#039; ).attr(&#039;name&#039;) == &#039;hidden&#039; )  {&lt;br /&gt;
					$( &#039;div#removeButton&#039;+qID ).hide();&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Just some initialization stuff&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody&#039;;&lt;br /&gt;
			var rowCount = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all except first row or any rows with populated inputs&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
				if ( i &amp;gt; 0 ) {&lt;br /&gt;
					// We also need to give the hidden rows a name cause IE doesn&#039;t&lt;br /&gt;
					// recognize jQuery :visible selector consistently&lt;br /&gt;
					$( this ).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
					$(&#039;input[type=text]&#039;, this).each(function(i) {&lt;br /&gt;
						if ($(this).attr(&#039;value&#039;) != &#039;&#039;) {&lt;br /&gt;
							$(this).parents(&#039;tbody:eq(0)&#039;).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
							$( &#039;div#removeButton&#039;+qID ).show();&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
					rowCount = i;&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// Call the function with a question ID&lt;br /&gt;
	varLengthArray(QQ);&lt;br /&gt;
&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Expandable Array=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to present an array question incrementally. That is to say that initially only the first option (row) in the array is shown. When that option is answered the next is shown and so-on.&lt;br /&gt;
&lt;br /&gt;
A JavaScript function is placed in the source of the array question. This function hides all of the array rows except the first and then displays them as options are answered.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=94958&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
The workaround supports following question types:&lt;br /&gt;
*Array (flexible labels)&lt;br /&gt;
*Array (flexible labels) by column&lt;br /&gt;
*Array (Yes/No/Uncertain)&lt;br /&gt;
*Array (Increase, Same, Decrease)&lt;br /&gt;
*Array (Flexible Labels) dual scale&lt;br /&gt;
*Array (10 point choice)&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Set up your survey to use JavaScript. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|documentation here]])&lt;br /&gt;
#Create one or more Array questions&lt;br /&gt;
#In the source of the first array question add the following script.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in the function call at the end of the script with the question ID of the array you would like to manipulate.&lt;br /&gt;
#If you want to apply it to more arrays on the same page, simply add more calls with the appropriate question IDs. (eg. expandingArray(1); expandingArray(2);...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// A function to show subsequent rows of an array as options are checked&lt;br /&gt;
		function expandingArray(qID) {&lt;br /&gt;
&lt;br /&gt;
			// Build an array of the question rows&lt;br /&gt;
			var arrayRow = &#039;#question&#039; + qID + &#039; table.question tbody tr&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Initially hide all rows unless an input was previously checked&lt;br /&gt;
			$( arrayRow ).each(function(i) {&lt;br /&gt;
&lt;br /&gt;
				if ( $( arrayRow  + &#039;:eq(&#039; + i + &#039;) input.radio:checked&#039; ).length != 0 ) {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(this).attr(&#039;name&#039;, &#039;hidden&#039;).hide();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Now show the first hidden row&lt;br /&gt;
			addRow();&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an option is checked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; td.answer input.radio&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// The original function of the click event&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Add another row when an table cell is clicked for the first time&lt;br /&gt;
			$( &#039;#question&#039; + qID + &#039; table.question tbody td&#039; ).click(function (event) {&lt;br /&gt;
&lt;br /&gt;
				if ($(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;) != &#039;clickedRow&#039;) {&lt;br /&gt;
					addRow();&lt;br /&gt;
					$(this).parents(&#039;tr:eq(0)&#039;).attr(&#039;name&#039;, &#039;clickedRow&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Function to add a row&lt;br /&gt;
			function addRow() {&lt;br /&gt;
				$( arrayRow + &#039;[name=&amp;quot;hidden&amp;quot;]:first&#039; ).attr(&#039;name&#039;, &#039;visible&#039;).show();&lt;br /&gt;
				// Now, scroll down&lt;br /&gt;
				$(&amp;quot;html, body&amp;quot;).animate({ scrollTop: $(document).height() }, 1000);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with a question ID&lt;br /&gt;
		expandingArray(QQ);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Array questions to be randomized while always keeping one sub-question at the end of the list.&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the sub-question with a defined code to the bottom of the array.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create an Array type question. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedCode&amp;quot; value as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// The sub-question code to place in the last position&lt;br /&gt;
		var fixedCode = &#039;A1&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var q1ID = {QID};&lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+q1ID);&lt;br /&gt;
 &lt;br /&gt;
		// Move the &amp;quot;fixed&amp;quot; row to the end&lt;br /&gt;
		$(&#039;table.subquestion-list tbody&#039;, thisQuestion).append($(&#039;tr[id$=&amp;quot;X&#039;+q1ID+fixedCode+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			&lt;br /&gt;
		// Fix up the array row background colours&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
			$(this).removeClass(&#039;array1 array2&#039;).addClass(&#039;array&#039;+(2-(i%2)));&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_randomized_array.lss|Partially_randomized_array.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:random_336x179gif.gif]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred a function in the source of a question moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Partially_Randomized_Answers_1.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
 &lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
 &lt;br /&gt;
		// Place the last answer created at the end of the list&lt;br /&gt;
		var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+ansCount+&#039;&amp;quot;]&#039;);&lt;br /&gt;
		var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
		var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
		$(answersList).append(answerItem);&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Partially_Ranomized_Answers.lss|Partially_Ranomized_Answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple Options &amp;amp; List (radio) questions (Enhanced)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey versions 2.06 and 2.73.0&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows the answers of Multiple Options &amp;amp; List (radio) questions to be randomized while always keeping a specified number of answers fixed at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth and sixth displayed last as in the image below:&lt;br /&gt;
&lt;br /&gt;
[[File:Random v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
After the LimeSurvey randomizing has occurred, a function in the source of a question moves the answers with the highest answer codes to the end of the list.&lt;br /&gt;
&lt;br /&gt;
Some conditions on the use of this are:&lt;br /&gt;
*The &amp;quot;Show No answer&amp;quot; survey setting must be set to &amp;quot;No&amp;quot; &lt;br /&gt;
*You must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:Random answers v2.50.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.06:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; li.answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $( &#039;input[id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;li&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;ul&#039;);&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;li&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;ul&#039;);&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Implementation for LimeSurvey version 2.73.0:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]]&lt;br /&gt;
#Create a Multiple Options or List (radio) question with sequential response codes. &lt;br /&gt;
#Set the &amp;quot;Random order&amp;quot; question setting to &amp;quot;Randomize on each page load&amp;quot;.&lt;br /&gt;
#Place the following script in the source of the question.&lt;br /&gt;
#Modify the &amp;quot;fixedAnswers&amp;quot; and &amp;quot;otherFixed&amp;quot; variables as required.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
	&lt;br /&gt;
		// The number of answers to be fixed at the end of the list&lt;br /&gt;
		var fixedAnswers = 2;&lt;br /&gt;
&lt;br /&gt;
		// Set this to &amp;quot;true&amp;quot; if you want &amp;quot;Other&amp;quot; to be fixed in the last position&lt;br /&gt;
		var otherFixed = false;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var qID = {QID}; &lt;br /&gt;
		&lt;br /&gt;
		// Find the number of answers&lt;br /&gt;
		var ansCount = $(&#039;#question&#039;+qID+&#039; .answer-item&#039;).length;&lt;br /&gt;
		if($(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			ansCount = ansCount -1&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Place the last n answers created at the end of the list&lt;br /&gt;
		var fixedIndex = fixedAnswers - 1;&lt;br /&gt;
		for (var i=0; i&amp;lt;fixedAnswers; i++) {&lt;br /&gt;
			var answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+&#039;s&#039;+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
			var answerItem = $(answer).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var answersList = $(answer).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				answer = $(&#039;input[id^=&amp;quot;answer&amp;quot;][id$=&amp;quot;X&#039;+qID+(ansCount-fixedIndex)+&#039;&amp;quot;]&#039;);&lt;br /&gt;
				answerItem = $(answer).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				answersList = $(answer).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(answersList).append(answerItem);&lt;br /&gt;
			fixedIndex--;&lt;br /&gt;
		}		&lt;br /&gt;
		&lt;br /&gt;
		// Handle &amp;quot;Other&amp;quot;&lt;br /&gt;
		if(otherFixed == true &amp;amp;&amp;amp; $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).length &amp;gt; 0) {&lt;br /&gt;
			var otherAnswer = $(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;);&lt;br /&gt;
			var otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;);&lt;br /&gt;
			var otherAnswersList = $(otherAnswer ).closest(&#039;.answers-list&#039;);&lt;br /&gt;
			if($(&#039;#question&#039;+qID).hasClass(&#039;multiple-opt&#039;)) {&lt;br /&gt;
				otherAnswerItem = $(otherAnswer ).closest(&#039;.answer-item&#039;).parent();&lt;br /&gt;
				otherAnswersList = $(otherAnswer ).closest(&#039;.subquestion-list&#039;);&lt;br /&gt;
			}&lt;br /&gt;
			$(otherAnswersList).append(otherAnswerItem);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - List (dropdown) questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, FireFox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the one above, allows the answers of List (dropdown) questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
A script is placed in the source of a question. After the randomizing has occurred this script moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
There is a demo [http://www.partnersinc.biz/surveys//index.php?sid=89344&amp;amp;newtest=Y&amp;amp;lang=en here].&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more List (dropdown) questions with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers&lt;br /&gt;
		//except the last one in List/dropdown questions&lt;br /&gt;
		function partRandDD(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; select option&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = i;&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list&lt;br /&gt;
			$( &#039;option[value=&amp;quot;&#039; + ansCount + &#039;&amp;quot;]&#039; ).appendTo($( &#039;div#question&#039; + qID + &#039; select&#039; ));&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRandDD(89344, 72, 244);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Partially Randomized Answers - Multiple numerical input=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, Safari 5.1&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround, similar to the ones above, allows the answers of Multiple numerical input questions to be randomized while always keeping one answer at the end of the list. It&#039;s useful if you want to randomize, say, the first 4 of your answers but always have the fifth displayed last.&lt;br /&gt;
&lt;br /&gt;
An onload function is placed in the source of a question. After the randomizing has occurred this function moves the answer with the highest answer code to the end of the list.&lt;br /&gt;
&lt;br /&gt;
A condition is that you must use sequential numbers, starting at 1 as response codes. (See image below)&lt;br /&gt;
&lt;br /&gt;
[[File:random_700x154.png]]&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions. (See [[Optional settings#Security|documentation here]])&lt;br /&gt;
#Create one or more Multiple numerical input question with sequential response codes. Set the [[Advanced question settings#random order|random_order question attribute]] to 1.&lt;br /&gt;
#In the source of the first question add the following onload function. (See [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]])&lt;br /&gt;
#Replace &amp;quot;SSSSS&amp;quot;, &amp;quot;GG&amp;quot;, &amp;quot;QQ&amp;quot; in the function call at the end with the survey ID, group ID and question ID respectively.&lt;br /&gt;
#If you want to apply it to more questions on the same page simply add more calls with the appropriate IDs. (eg. partRandDD(11111, 22, 1); partRandDD(11111, 22, 2); ...)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Function to allow randomization of all answers except the last one in multiple numeric input questions&lt;br /&gt;
		function partRand(sID, gID, qID) {&lt;br /&gt;
&lt;br /&gt;
			// Find the number of answers&lt;br /&gt;
			var ansCount = &#039;&#039;&lt;br /&gt;
			$( &#039;div#question&#039; + qID + &#039; div.answers li&#039; ).each(function(i) {&lt;br /&gt;
				ansCount = (i - 1);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Place the last answer created at the end of the list - but before the first helping sum&lt;br /&gt;
			$( &#039;li#javatbd&#039; + sID + &#039;X&#039; + gID + &#039;X&#039; + qID + ansCount + &#039;&#039; ).insertBefore($( &#039;div#question&#039; + qID + &#039; div.answers li.multiplenumerichelp&#039; ).first());&lt;br /&gt;
&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Call the function with the SID, GID and QID&lt;br /&gt;
		partRand(SID, GID, QID);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this solution for Multiple numerical input questions might be a bit more complicated than for other question types. All answers are organized in an unordered list (&amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;/nowiki&amp;gt;) structure. However, if advanced question settings like &#039;&#039;Equals sum value&#039;&#039; are used, LimeSurvey adds helping information (e.g. sum of all entries and remainder) to the same unordered list using the class &#039;&#039;multiplenumerichelp&#039;&#039; for these additional list items. The above example  assumes that at least one of these list items is present and moves the last answer to the position right above the first helper item. Without such advanced settings, the code will most certainly need adaptation.&lt;br /&gt;
&lt;br /&gt;
=Making one (or more) rows of an array mandatory=&lt;br /&gt;
&lt;br /&gt;
{{Hint|Text=With Expression manager, you can use [[Expression_Manager_Examples#Using_em_validation_q_in_array|Using em_validation_q in array]] system.}} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7, Firefox 3.0, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround allows you to define one or more rows of an array question as mandatory (instead of all of them which the &amp;quot;Mandatory&amp;quot; question setting does). It is [http://www.partnersinc.biz/surveys//index.php?sid=26842&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
A JavaScript function interrupts the submit function and checks if the inputs in the mandatory row(s) are populated. If not, an alert is popped up, the offending inputs are turned pink and the submit is aborted. Otherwise the submit goes ahead.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Turn off &#039;&#039;$filterxsshtml&#039;&#039; to allow insertion of JavaScript in the questions (see [[Optional settings#Security|documentation here]]).&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script (see [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]).&lt;br /&gt;
#Modify the warningText (line10)as required.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; (lines 13 and 14)  with the question ID and add calls as necessary for more rows - the example code renders rows 1 and 3 mandatory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function () {&lt;br /&gt;
&lt;br /&gt;
		// Interrupt the submit function&lt;br /&gt;
		$(&#039;form#limesurvey&#039;).submit(function () {&lt;br /&gt;
&lt;br /&gt;
			// Override the built-in &amp;quot;disable navigation buttons&amp;quot; feature&lt;br /&gt;
			$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).attr(&#039;disabled&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
			var empty = 0;&lt;br /&gt;
			var warningText = &#039;Please complete the highlighted inputs.&#039;;&lt;br /&gt;
&lt;br /&gt;
			// Call the mandatory row function with question IDs and row numbers&lt;br /&gt;
			mandatoryRow(QQ, 1);&lt;br /&gt;
			mandatoryRow(QQ, 3);&lt;br /&gt;
&lt;br /&gt;
			// A function to render rows of an array mandatory&lt;br /&gt;
			function mandatoryRow(qID, rowNum) {&lt;br /&gt;
&lt;br /&gt;
				$(&#039;div#question&#039; + qID + &#039; table.question tbody[id^=&amp;quot;javatbd&amp;quot;]:eq(&#039; + Number(rowNum - 1) + &#039;) input[type=&amp;quot;text&amp;quot;]&#039;).each(function (i) {&lt;br /&gt;
&lt;br /&gt;
					if ($(this).val() == &#039;&#039;) {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;pink&#039;);&lt;br /&gt;
						empty = 1;&lt;br /&gt;
					} &lt;br /&gt;
					else {&lt;br /&gt;
						$(this).css(&#039;background-color&#039;, &#039;#FFFFFF&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if (empty == 1) {&lt;br /&gt;
				alert(warningText);&lt;br /&gt;
				return false;&lt;br /&gt;
			} &lt;br /&gt;
			else {&lt;br /&gt;
				return true;&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few YouTube videos, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Jason Cleeland has created and documented a method to randomly display one of a number of youtube videos in a single question, and save which one was displayed.&lt;br /&gt;
&lt;br /&gt;
http://www.aptigence.com.au/home/archives/23-Random-display-of-videos-in-a-question-2-YouTube.html&lt;br /&gt;
&lt;br /&gt;
=Randomly displaying one of a few pictures, and recording which was displayed=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.91+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps allow you to randomly display one of a few pictures and record in the dataset which picture was displayed. We use four pictures in this example, but you can easily adapt these scripts according to your needs.&lt;br /&gt;
&lt;br /&gt;
1. Create a new sub-directory &#039;&#039;&#039;pic&#039;&#039;&#039; in your LimeSurvey folder.&lt;br /&gt;
&lt;br /&gt;
2. Copy four pictures (named &#039;&#039;1.jpg&#039;&#039;, &#039;&#039;2.jpg&#039;&#039;, &#039;&#039;3.jpg&#039;&#039;, and &#039;&#039;4.jpg&#039;&#039;) in this pic sub-directory.&lt;br /&gt;
&lt;br /&gt;
3. Deactivate the &#039;&#039;Filter HTML for XSS&#039;&#039; function in LimeSurvey&#039;s &#039;&#039;Global Settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
4. Create a &#039;&#039;&#039;Short free text&#039;&#039;&#039; question where you want these pictures to be displayed.&lt;br /&gt;
&lt;br /&gt;
5. Figure out the [[SGQA identifier|SGQA Identifier]] of this question (e.g., 12345X67X89).&lt;br /&gt;
&lt;br /&gt;
6. Paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view and replace both SSSSSXGGXQQ strings with your SGQA identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please have a look at this picture:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Find a random number (here between 1 and 4)&lt;br /&gt;
&lt;br /&gt;
var randNumber = Math.floor(Math.random()*4 + 1);&lt;br /&gt;
&lt;br /&gt;
// Save the number as answer of this question&lt;br /&gt;
&lt;br /&gt;
$(&#039;input#answerSSSSSXGGXQQ&#039;).val(randNumber);&lt;br /&gt;
&lt;br /&gt;
// Hide this answer field&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&amp;quot;answerSSSSSXGGXQQ&amp;quot;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
// Show the picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to display the number of this picture in a later question, use the following code as question text (don&#039;t forget to replace the SSSSSXGGXQQ string acordingly):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You saw picture number {INSERTANS:SSSSSXGGXQQ}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you want to display the same picture again in a later question, but a little bit smaller (100px width, 100px height)? Just paste the following code as question text after activating the editor&#039;s &#039;&#039;Source&#039;&#039; view, and replace the SSSSSXGGXQQ string acordingly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you see the picture again: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(&lt;br /&gt;
&lt;br /&gt;
function(){&lt;br /&gt;
&lt;br /&gt;
// Get the picture number from previous question&lt;br /&gt;
&lt;br /&gt;
var randNumber = &amp;quot;{INSERTANS:SSSSSXGGXQQ}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Show picture&lt;br /&gt;
&lt;br /&gt;
picString = &#039;&amp;lt;img width=&amp;quot;100&amp;quot; height=&amp;quot;100&amp;quot; src=&amp;quot;pic/&#039; + String(randNumber) + &#039;.jpg&amp;quot;&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;pic&#039;).innerHTML = picString;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;pic&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple numerical input with max_num_value defined in token (personalized limit)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested in 1.85+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, max_num_value can be an experession, so you can simply enter the {TOKEN} or other variable in that question attribute.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make personalized survey with multiple numerical input when max_num_value (Maximum sum value) is different for each user and is loaded from the token use following tricks:&lt;br /&gt;
*Create 1st group with numerical input field (1000X10X11). &amp;quot;Limit&amp;quot;&lt;br /&gt;
*Add java script into this question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function Custom_On_Load(){&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).value=&#039;{TOKEN:ATTRIBUTE_1}&#039;;&lt;br /&gt;
&lt;br /&gt;
  document.getElementById(&#039;answer1000X10X11&#039;).readOnly=1;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
TOKEN:ATTRIBUTE_1 is individual limit defined in token.&lt;br /&gt;
&lt;br /&gt;
readOnly=1 // user shouldn&#039;t change it.&lt;br /&gt;
*Create 2nd group with multiple numerical input and add &amp;quot;Max value from SGQA&amp;quot; with 1000X10X11 as argument.&lt;br /&gt;
&lt;br /&gt;
Note: If you don&#039;t want to show first field with numerical input (and show definied limit in different way) you can add 2 lines to above script to hide whole question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;question85&#039;).style.display=&#039;none&#039;;&lt;br /&gt;
&lt;br /&gt;
document.getElementById(&#039;display85&#039;).value=&#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
question85 and display85 are field names.&lt;br /&gt;
&lt;br /&gt;
Note: It&#039;s no possible to create it into one group, because all SGQA references can only refer to data on a previous page because when clicking next the answer is stored at the DB and the SGQA is replaced by querying the database.&lt;br /&gt;
&lt;br /&gt;
=Default values in array questions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of an array type question. You can select a column of the array to be checked as the page loads. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Replace&amp;quot;QQ&amp;quot; with the question ID and &amp;quot;CC&amp;quot; with the column number to be checked.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// A function to pre-check a column of an array&lt;br /&gt;
		function checkedDefault(qID, column) {&lt;br /&gt;
			var checkedCol = column - 1;&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; tr.subquestions-list&#039;).each(function(i) {&lt;br /&gt;
				if ($(&#039;input.checkbox:checked&#039;, this).length == 0) {&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).prop(&#039;checked&#039;, true);&lt;br /&gt;
					$(&#039;input.checkbox:eq(&#039;+checkedCol+&#039;)&#039;, this).parent().find(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;).val(1);&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		// Call the function with a question ID and column number&lt;br /&gt;
		checkedDefault(QQ, CC);&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Values In One Scale Of A Dual-scale Array Question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.0+, IE 9/10, Firefox 24&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This workaround uses JavaScript to allow you to pre-check default answers in all sub-questions of one scale of a dual-scale-array type question. You can select a scale and a column of that scale to be checked. The script first checks to see if a sub-question has already been answered and, if not, checks the default answer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation:&#039;&#039;&#039;&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use script]].&lt;br /&gt;
#Create the array question.&lt;br /&gt;
#In the source of the array question add the following script.&lt;br /&gt;
#Adjust &amp;quot;&#039;&#039;defaultAnsweredScale&#039;&#039;&amp;quot; and &amp;quot;&#039;&#039;defaultAnsweredColumn&#039;&#039;&amp;quot; as necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
 &lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
  &lt;br /&gt;
		// Scale to set the default answer on&lt;br /&gt;
		var defaultAnsweredScale = 2; &lt;br /&gt;
		// Column of that scale to set as default answer&lt;br /&gt;
		var defaultAnsweredColumn = 3;&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{self.qid}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Identify the scales and columns&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_1&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-1-item&#039;);&lt;br /&gt;
		$(&#039;.answer-item[class^=&amp;quot;answer_cell_2&amp;quot;]&#039;, thisQuestion).addClass(&#039;scale-2-item&#039;);&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.scale-1-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-1-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.scale-2-item&#039;, this).each(function(i) {&lt;br /&gt;
				$(this).addClass(&#039;scale-2-column-&#039;+(i+1)+&#039;-item&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Click the default answers&lt;br /&gt;
		$(&#039;tr.answers-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			if($(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-item input[type=&amp;quot;radio&amp;quot;]:checked&#039;, this).length == 0) {&lt;br /&gt;
				$(&#039;.scale-&#039;+defaultAnsweredScale+&#039;-column-&#039;+defaultAnsweredColumn+&#039;-item input[type=&amp;quot;radio&amp;quot;]:last&#039;, this).click();&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download sample survey:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Dual_scale_with_default_answers.lss|Dual_scale_with_default_answers.lss]]&lt;br /&gt;
&lt;br /&gt;
=Record group view time=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.87+ (8518), IE 6/7, Firefox 3.5, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, group view time is accurately recorded in the timings table if you choose the Record Timings survey option.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to populate a hidden question with the total time that a respondent views a group. If used in a group with only one question, it could be used to track the amount of time required to answer the question.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#In the group, create a short-text question. We will hide this later with JavaScript and populate it with the elapsed time.&lt;br /&gt;
#Place the following script in the source of the short-text question.&lt;br /&gt;
#Replace &amp;quot;QQ&amp;quot; in line 6 with the ID of the short-text question.&lt;br /&gt;
&lt;br /&gt;
The script populates the hidden question with the elapsed time since the group was opened. If a respondent leaves the group and then returns, the timer continues up from the elapsed time of the last visit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
       // call the functions with the hidden timer question ID&lt;br /&gt;
&lt;br /&gt;
       runTimer(QQ);&lt;br /&gt;
&lt;br /&gt;
       function runTimer(timeQID) {&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+timeQID).hide();&lt;br /&gt;
&lt;br /&gt;
           var initSec = &#039;0&#039;;&lt;br /&gt;
&lt;br /&gt;
           // Check for elapsed time from previous visits&lt;br /&gt;
&lt;br /&gt;
           if ($(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val()) {&lt;br /&gt;
&lt;br /&gt;
               var initTime = $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               initTimeArr = initTime.split(&#039;:&#039;);&lt;br /&gt;
&lt;br /&gt;
               initSec = Number[[initTimeArr[0]*3600]]+Number[[initTimeArr[1]*60]]+Number(initTimeArr[2]);&lt;br /&gt;
&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
           // Run the timer update function&lt;br /&gt;
&lt;br /&gt;
           recordTime(initSec, timeQID);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
   // Timer update function&lt;br /&gt;
&lt;br /&gt;
   function recordTime(elapsedSec, timeQID){&lt;br /&gt;
&lt;br /&gt;
       elapsedSec++;&lt;br /&gt;
&lt;br /&gt;
       var h = Math.floor(elapsedSec / 3600);&lt;br /&gt;
&lt;br /&gt;
       var m = Math.floor(elapsedSec % 3600 / 60);&lt;br /&gt;
&lt;br /&gt;
       var s = Math.floor(elapsedSec % 3600 % 60);&lt;br /&gt;
&lt;br /&gt;
       var elapsedTime = [[h &amp;gt; 0 ? h + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (m &amp;gt; 0 ? (m &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + m + &amp;quot;:&amp;quot; : &amp;quot;00:&amp;quot;) + (s &amp;lt; 10 ? &amp;quot;0&amp;quot; : &amp;quot;&amp;quot;) + s);&lt;br /&gt;
&lt;br /&gt;
        $(&#039;#question&#039;+timeQID+&#039; input.text&#039;).val(elapsedTime);&lt;br /&gt;
&lt;br /&gt;
        // Run the timer update function every second&lt;br /&gt;
&lt;br /&gt;
        setTimeout(&#039;recordTime(&#039;+elapsedSec+&#039;, &#039;+timeQID+&#039;)&#039;,1000);&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Toggle visibility of groups=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to toggle the visibility of groups in an &amp;quot;all in one&amp;quot; survey. Initially the groups are hidden and there are links inserted to display the groups. It&#039;s useful to avoid the page being cluttered with many groups and lets the respondent focus on one at a time.&lt;br /&gt;
&lt;br /&gt;
It&#039;s [http://www.partnersinc.biz/surveys//index.php?sid=33613&amp;amp;newtest=Y&amp;amp;lang=en demonstrated here].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Set the survey to run in &amp;quot;all in one&amp;quot; mode.&lt;br /&gt;
#Add your groups and questions.&lt;br /&gt;
#Place the following script in the source of one of the questions in the first group.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The comments in the script are pretty self-explanatory but it does the following:&lt;br /&gt;
&lt;br /&gt;
#initially hides all of the groups&lt;br /&gt;
#inserts a link above each one to toggle its display&lt;br /&gt;
#some styles are added to the clickable links but these could be done in template.css instead&lt;br /&gt;
#shows any groups that have an unanswered mandatory after a submit attempt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		// Insert show/hide divs before all group wrapper divs&lt;br /&gt;
		$(&#039;&amp;lt;div class=&amp;quot;groupToggler&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&#039;).insertBefore(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Add some text to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).each(function(i) {&lt;br /&gt;
			($( this ).text(&#039;Show/Hide Group &#039;+(i+1)+&#039;&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some styles to the show/hide divs&lt;br /&gt;
		$(&#039;.groupToggler&#039;).css({&lt;br /&gt;
			&#039;padding&#039;:&#039;5px 0 10px 0&#039;,&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).css({&lt;br /&gt;
			&#039;text-decoration&#039;:&#039;underline&#039;,			&lt;br /&gt;
			&#039;cursor&#039;:&#039;pointer&#039;&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		// Add some hover effects to the show/hide divs&lt;br /&gt;
		$(&amp;quot;.groupToggler span&amp;quot;).hover(&lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;none&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;bold&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}, &lt;br /&gt;
			function () {&lt;br /&gt;
				$(this).css({&lt;br /&gt;
					&#039;text-decoration&#039;:&#039;underline&#039;,&lt;br /&gt;
					&#039;font-weight&#039;:&#039;normal&#039;&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		);&lt;br /&gt;
		&lt;br /&gt;
		// Initially hide all of the groups&lt;br /&gt;
		// Toggle their visibility when the show/hide is clicked&lt;br /&gt;
		$(&#039;.groupToggler span&#039;).click(function() {&lt;br /&gt;
			$(this).parent().next().toggle();&lt;br /&gt;
			return false;&lt;br /&gt;
		}).parent().next().hide();&lt;br /&gt;
		&lt;br /&gt;
		// Display any groups that have unanswered mandatories&lt;br /&gt;
		$(&#039;.errormandatory&#039;).parents(&#039;div[id^=&amp;quot;group-&amp;quot;]&#039;).show();&lt;br /&gt;
		&lt;br /&gt;
		// Some tidying up&lt;br /&gt;
		$(&#039;h1&#039;).next().next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).css({&lt;br /&gt;
			&#039;margin-bottom&#039;:&#039;10px&#039;&lt;br /&gt;
		});&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().hide();&lt;br /&gt;
		$(&#039;.surveywelcome&#039;).next().next().hide();&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Use jQuery Autocomplete plugin to suggest answers for text inputs=&lt;br /&gt;
&lt;br /&gt;
== 1.91 and later versions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 6/7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI to provide a respondent a list of suggested answers that the they can select from as they type in a text input.&lt;br /&gt;
&lt;br /&gt;
Although the plugin allows for much more complex applications, the two that I use most frequently are outlined below. The first method uses a relatively small list of suggestions that is stored in an array locally. The second is a little more complex - it uses a remote CSV file of suggestions that is accessed through AJAX an PHP.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Both methods:&#039;&#039;&#039;&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
	width: 250px !important;&lt;br /&gt;
	padding: 5px 10px;&lt;br /&gt;
	list-style: none;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 1 (use local JavaScript array for data):&#039;&#039;&#039;&lt;br /&gt;
*Create a text input question&lt;br /&gt;
*Add the following script to the source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace the states with your list of suggestions (comma separated)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var q1ID = &#039;QQ&#039;;&lt;br /&gt;
&lt;br /&gt;
		var states = &amp;quot;Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming&amp;quot;.split(&#039;,&#039;);&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#question&#039;+q1ID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
			source: states&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Method 2 (use remote CSV file for data):&#039;&#039;&#039;&lt;br /&gt;
*Place the CSV file of suggestions in your template directory&lt;br /&gt;
*Place a PHP file containing the code below in your template directory&lt;br /&gt;
*Replace &amp;quot;countries2.csv&amp;quot; with your CSV filename (you could make this more universal by passing the filename in the URL)&lt;br /&gt;
*This file will grab the contents of the CSV and encode them in JSON format that the JavaScript can use&lt;br /&gt;
*Place the JavaScript code below in ths source of the text question&lt;br /&gt;
*Replace &amp;quot;QQ&amp;quot; with the ID of the text input question&lt;br /&gt;
*Replace &amp;quot;templates/yourTemplate/countries.php&amp;quot; with the path to the PHP file (from LimeSurvey root)&lt;br /&gt;
*This script will grab the jsonized data from the PHP file and load it into an array that the plugin can use&lt;br /&gt;
&lt;br /&gt;
PHP code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
	$countriesArr = array();&lt;br /&gt;
&lt;br /&gt;
	$file_handle = fopen(&amp;quot;countries2.csv&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	while (!feof($file_handle) ) {&lt;br /&gt;
		$line_of_text = fgetcsv($file_handle);&lt;br /&gt;
		array_push($countriesArr, $line_of_text[0]);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	fclose($file_handle);&lt;br /&gt;
&lt;br /&gt;
	echo json_encode($countriesArr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JavaScript code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qID = QQ;&lt;br /&gt;
		var url = &amp;quot;templates/yourTemplate/countries.php&amp;quot;;&lt;br /&gt;
		var dataArr = [];&lt;br /&gt;
&lt;br /&gt;
		$.getJSON(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			$.each(data,function(i, item){&lt;br /&gt;
				dataArr.push(item);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: dataArr&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== Update for LimeSurvey 2.05+ ==&lt;br /&gt;
&#039;&#039;Tested with: 2.05+, Chrome 40, FireFox 36, Opera 27, IE 11&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With LimeSurvey 2.05+ it is NOT necessary to:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Download the jQuery Autocomplete widget&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add special autocomplete styling to the survey template (tested with the Skeletonquest template by Denis Chenu)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround builds on the previous examples, but is updated for use with newer versions of LimeSurvey. Note that the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] is already included in LimeSurvey, as part of jQuery UI.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Autocomplete may be configured to use different types of data input, three of which will be demonstrated in the following: Plain text, CSV-files, and MySQL databases.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;1. Plain text input (the easiest, suitable for small lists or arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To enable autocomplete of a list in plain text, simply add the following code to your question source. You will have to change qID to the question ID of the question you want the autocomplete to run in (this does not have to be the one you add the script to). In this case, the list has been added to the source directly, but you may also call the list as a predefined variable (see [http://jqueryui.com/demos/autocomplete/ jQuery website] for example):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
 &lt;br /&gt;
		var qID = 1;&lt;br /&gt;
 &lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: [&amp;quot;Test1&amp;quot;,&amp;quot;Test2&amp;quot;,&amp;quot;Test3&amp;quot;]&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that, with this method, all processing happens browser-side. Thus, the entire contents of your CSV file will be exposed, no matter where you &amp;quot;hide&amp;quot; it (it is not possible to request files from outside the webroot on your server using javascript). If any of this concerns you, please proceed to the next paragraph, which deals with autocomplete based on database queries. To enable autocomplete based on output from a CSV file, you will need the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;A comma-separated data file (CSV)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The [https://code.google.com/p/jquery-csv/ jquery.csv.js plugin] (v0.71)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, download the jquery.csv.js script, and place it in the template folder (may require manual FTP, rather than upload through the template manager). You will need to call this script in the head section of the survey page, which you find in startpage.pstpl. Make sure you call it &amp;lt;strong&amp;gt;before&amp;lt;/strong&amp;gt; {TEMPLATEJS}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html5&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
To make the CSV file, you may use Microsoft Excel and &amp;quot;Save as CSV&amp;quot;. Note that Excel produces CSV files where the columns are separated by a &amp;lt;strong&amp;gt;semicolon&amp;lt;/strong&amp;gt;, not a comma. To make this work with the jquery.csv.js plugin, you will have to edit the jquery.csv.js file on line 43:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
41  $.csv = {&lt;br /&gt;
42    defaults: {&lt;br /&gt;
43      separator:&#039;,&#039;,  // Change this to: separator:&#039;;&#039;,&lt;br /&gt;
44      delimiter:&#039;&amp;quot;&#039;,&lt;br /&gt;
45      headers:true&lt;br /&gt;
46    },&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Once the CSV file is in place, add the following javascript to your question source, using the correct question ID (qID) and url/filename for your CSV file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
                var qID = 1;&lt;br /&gt;
&lt;br /&gt;
		var surveyRoot = location.pathname.split(&#039;index.php&#039;)[0];&lt;br /&gt;
                var url = surveyRoot+&#039;datafile.csv&#039;;&lt;br /&gt;
&lt;br /&gt;
                // Create an array to hold the data&lt;br /&gt;
                var testArr = new Array();&lt;br /&gt;
&lt;br /&gt;
                // Grab the CSV contents&lt;br /&gt;
                $.get(url,function(data){&lt;br /&gt;
				&lt;br /&gt;
                        // Convert CSV contents to an array of arrays&lt;br /&gt;
                        fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
                        // Load the data array&lt;br /&gt;
                        $(fullArray).each(function(i, item){&lt;br /&gt;
                                testArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                        // Initialise the autocomplete plugin&lt;br /&gt;
                        $(&#039;#question&#039;+qID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
                                source: testArr&lt;br /&gt;
			});&lt;br /&gt;
						&lt;br /&gt;
			// console.log(data); This would be a gould place to put your debugging script. Remember to comment out or remove before going into production, to economize on server workload&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Now, the autocomplete should work. If not, see if your CSV file shows up under &amp;quot;Network&amp;quot; or &amp;quot;Resources&amp;quot; in your browser&#039;s inspector, and if it provides any output. Adding &amp;lt;strong&amp;gt;console.log(data);&amp;lt;/strong&amp;gt; to your javascript (as indicated) should output the data to the browser console (you&#039;ll see the contents of your CSV file), and may be useful for debugging. Note that only the data from the current function (the function, within which the text was placed) will be presented.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;3. Input from a MySQL database (trickiest, but also the most versatile and secure).&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;This method requires the following:&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;Access to a MySQL database (tested with MySQL 5.5)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;A PHP script to connect to and query the database&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, paste the following script in your question source code, replacing for the correct question ID (qID) and the url/filename of your master PHP file (which in this case is autocomplete.php, see below):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    $(document).ready(function() {&lt;br /&gt;
		&lt;br /&gt;
		var qID = 1;&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question&#039;+qID+&#039; input[type=&amp;quot;text&amp;quot;]&#039;).autocomplete({&lt;br /&gt;
			minLength: 2,  // This line is optional, signifies number of keystrokes before autocomplete is initiated&lt;br /&gt;
			source: &#039;autocomplete.php&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The structure of the database shouldn&#039;t matter too much, as long as you are using text fields. This example uses the UTF-8 character set. It is often a good idea to keep your login credentials in a separate file that you put outside of your webroot. In this case, I&#039;ve put them in a file called constant.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Login credentials&lt;br /&gt;
define(&#039;DB_SERVER&#039;, &amp;quot;localhost&amp;quot;);&lt;br /&gt;
define(&#039;DB_USER&#039;, &amp;quot;username&amp;quot;);&lt;br /&gt;
define(&#039;DB_PASSWORD&#039;, &amp;quot;password&amp;quot;);&lt;br /&gt;
define(&#039;DB_DATABASE&#039;, &amp;quot;database_name&amp;quot;);&lt;br /&gt;
define(&#039;DB_DRIVER&#039;, &amp;quot;mysql&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
The next file, database.php, deals with logging in to the database and performing the query that was requested through the javascript pasted above. Note that we&#039;re using the PDO convention rather than mysql_*, which has been deprecated for safety reasons (MySQLi remains a viable alternative, but is not shown here):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Connect and query MySQL database, using PDO&lt;br /&gt;
try {&lt;br /&gt;
  $db = new PDO(DB_DRIVER . &amp;quot;:dbname=&amp;quot; . DB_DATABASE . &amp;quot;;host=&amp;quot; . DB_SERVER . &amp;quot;;charset=utf8&amp;quot;, DB_USER, DB_PASSWORD);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
catch(PDOException $e) {&lt;br /&gt;
    echo $e-&amp;gt;getMessage();&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
$return_arr = array();&lt;br /&gt;
 &lt;br /&gt;
if ($db)&lt;br /&gt;
{&lt;br /&gt;
	$ac_term = &amp;quot;%&amp;quot;.$_GET[&#039;term&#039;].&amp;quot;%&amp;quot;;&lt;br /&gt;
	$query = &amp;quot;SELECT * FROM table_name WHERE column_name LIKE :term&amp;quot;;&lt;br /&gt;
	$result = $db-&amp;gt;prepare($query);&lt;br /&gt;
	$result-&amp;gt;bindValue(&amp;quot;:term&amp;quot;,$ac_term); &lt;br /&gt;
	$result-&amp;gt;execute(); &lt;br /&gt;
 &lt;br /&gt;
// Fetch data and store in array&lt;br /&gt;
	while ($row = $result-&amp;gt;fetch(PDO::FETCH_ASSOC)) {&lt;br /&gt;
		$row_array[&#039;label&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
		$row_array[&#039;value&#039;] = $row[&#039;column_name&#039;];&lt;br /&gt;
 &lt;br /&gt;
        array_push($return_arr,$row_array);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Finally, a PHP file (autocomplete.php) to include the previous two files and complete the query. This is the file that is called by the javascript, and the only one placed in the webroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// Include files outside of webroot&lt;br /&gt;
set_include_path(&#039;/var/www/surveys/test-survey&#039;);&lt;br /&gt;
&lt;br /&gt;
// Fetch database credentials&lt;br /&gt;
require_once (&#039;constant.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Connect to database and perform query&lt;br /&gt;
require_once (&#039;database.php&#039;);&lt;br /&gt;
&lt;br /&gt;
// Clear query&lt;br /&gt;
$db = null;  &lt;br /&gt;
 &lt;br /&gt;
// Encode results in JSON. This is required for jquery autocomplete&lt;br /&gt;
echo json_encode($return_arr);&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
This should complete your setup, but there are obviously a variety of pitfalls, at which point the previously outlined debugging techniques may be of help.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use autocomplete to populate several fields==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, IE 7/8/9, Firefox 18&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses the [http://jqueryui.com/demos/autocomplete/ Autocomplete widget] included with jQuery UI and the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin to provide a respondent with a list of suggested answers as they type in a text input and then to automatically populate other fields depending on the selection.&lt;br /&gt;
&lt;br /&gt;
For example, if you have 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; - you can use this workaround to autocomplete the &amp;quot;Name&amp;quot; question and then the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; questions can be automatically populated with values associated with the selected name.&lt;br /&gt;
*Download the [https://code.google.com/p/jquery-csv/downloads/list jquery.csv.js] plugin and place it in your template folder&lt;br /&gt;
*If using LimeSurvey 1.9x, add the following line to your startpage.pstpl BEFORE the tag for template.js, if using 2.x, add it AFTER the {TEMPLATEJS} placeholder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;{TEMPLATEURL}jquery.csv.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your CSV file with 3 columns (name, ID, email) as in this example and place it in your template folder&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;Bob,    Bob&#039;s ID,    Bob&#039;s email&lt;br /&gt;
&lt;br /&gt;
Andy,    Andy&#039;s ID,    Andy&#039;s email&lt;br /&gt;
&lt;br /&gt;
Sam,    Sam&#039;s ID,    Sam&#039;s email&lt;br /&gt;
&lt;br /&gt;
Tony,    Tony&#039;s ID,    Tony&#039;s email&lt;br /&gt;
&lt;br /&gt;
Fred,    Fred&#039;s ID,    Fred&#039;s email&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Create your 3 questions - &amp;quot;Name&amp;quot;, &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot;. They must be in the same group/page.&lt;br /&gt;
*Add the following styles to the end of your &#039;template.css&#039; file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* Autocomplete styles */&lt;br /&gt;
&lt;br /&gt;
ul.ui-autocomplete {&lt;br /&gt;
&lt;br /&gt;
   width: 250px !important;&lt;br /&gt;
&lt;br /&gt;
   padding: 5px 10px;&lt;br /&gt;
&lt;br /&gt;
   list-style: none;&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*Add the following script to the source of one of the questions&lt;br /&gt;
*Replace:&lt;br /&gt;
**&amp;quot;NN&amp;quot; with the &amp;quot;Name&amp;quot; question ID&lt;br /&gt;
**&amp;quot;II&amp;quot; with the &amp;quot;ID&amp;quot; question ID&lt;br /&gt;
**&amp;quot;EE&amp;quot; with the &amp;quot;Email&amp;quot; question ID&lt;br /&gt;
*Modify the path to your CSV file&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		var qNameID = NN;&lt;br /&gt;
&lt;br /&gt;
		var qIDID = II;&lt;br /&gt;
&lt;br /&gt;
		var qEmailID = EE;&lt;br /&gt;
&lt;br /&gt;
		var url = &amp;quot;upload/templates/yourTemplate/yourCsvFile.csv&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		// Create an array to hold the names&lt;br /&gt;
		var namesArr = new Array();&lt;br /&gt;
&lt;br /&gt;
		// Grab the CSV contents&lt;br /&gt;
		$.get(url,function(data){&lt;br /&gt;
&lt;br /&gt;
			// Convert CSV contents to an array of arrays&lt;br /&gt;
			fullArray = $.csv.toArrays(data);&lt;br /&gt;
&lt;br /&gt;
			// Load the names array&lt;br /&gt;
			$(fullArray).each(function(i, item){&lt;br /&gt;
				namesArr.push(item[0]);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			// Initialise the autocomplete plugin&lt;br /&gt;
			$(&#039;#question&#039;+qNameID+&#039; input.text&#039;).autocomplete({&lt;br /&gt;
				source: namesArr,&lt;br /&gt;
				// Event fired when a selection is made (ui.item.value refers to the selected item)&lt;br /&gt;
				select: function(event, ui) {&lt;br /&gt;
					// Find the &amp;quot;ID&amp;quot; and &amp;quot;Email&amp;quot; values associated with the selected name value and load those questions&lt;br /&gt;
					$(fullArray).each(function(i, item){&lt;br /&gt;
						if(item[0] == ui.item.value) {&lt;br /&gt;
							// The value from column 2 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qIDID+&#039; input.text&#039;).val(item[1]);&lt;br /&gt;
							// The value from column 3 of the CSV&lt;br /&gt;
							$(&#039;#question&#039;+qEmailID+&#039; input.text&#039;).val(item[2]);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Create MaxDiff question type=&lt;br /&gt;
&lt;br /&gt;
See the [[Workarounds: Question design, layout and templating|Question design, layout and templating]] section for a workaround that uses JavaScript to convert an &#039;&#039;&#039;&#039;&#039;Array (flexible labels) by column&#039;&#039;&#039;&#039;&#039; question into a [http://en.wikipedia.org/wiki/MaxDiff MaxDiff] question type.&lt;br /&gt;
&lt;br /&gt;
[[File:max_diff_596x253.gif]]&lt;br /&gt;
&lt;br /&gt;
=In a checkbox matrix, have the &#039;none&#039; option in a row disable all other columns in that row=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey 1.90+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The questionId parameter is the base ID of the question matrix (multiflexible).&lt;br /&gt;
&lt;br /&gt;
numColumns and numRows speak for themselves&lt;br /&gt;
&lt;br /&gt;
specialColumns is an array of the columns that have the special ability that when one of them&lt;br /&gt;
&lt;br /&gt;
is checked, none of the others can be checked. E.g., a &#039;none of these&#039; and/or a &#039;do now know&#039; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
numColumns=13;&lt;br /&gt;
&lt;br /&gt;
numRows=18;&lt;br /&gt;
&lt;br /&gt;
questionId=&#039;28417X2X24&#039;;&lt;br /&gt;
&lt;br /&gt;
specialColumns=[1,12,13];&lt;br /&gt;
&lt;br /&gt;
function action(obj){&lt;br /&gt;
&lt;br /&gt;
   locator=obj.id.replace(&#039;cbox_&#039;+questionId, &#039;&#039;).split(&#039;_&#039;);&lt;br /&gt;
&lt;br /&gt;
   row=locator[0];&lt;br /&gt;
&lt;br /&gt;
   column=locator[1];&lt;br /&gt;
&lt;br /&gt;
   //alert(&#039;Action for row,column=&#039;+row+&#039;,&#039;+column);&lt;br /&gt;
&lt;br /&gt;
   my_id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
   if($(my_id).attr(&#039;checked&#039;) == false) {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,false);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
&lt;br /&gt;
       for( var i=1; i&amp;lt;=numColumns; i++ ) {&lt;br /&gt;
&lt;br /&gt;
           if(i==column) continue;&lt;br /&gt;
&lt;br /&gt;
           id=&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           aid=&#039;#answer&#039;+questionId+row+&#039;_&#039;+i&lt;br /&gt;
&lt;br /&gt;
           $(aid).val(0);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;checked&#039;,false);&lt;br /&gt;
&lt;br /&gt;
           $(id).attr(&#039;disabled&#039;,true);&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function customOnLoad(){&lt;br /&gt;
&lt;br /&gt;
   for( var row=1; row&amp;lt;=numRows; row++ ) {&lt;br /&gt;
&lt;br /&gt;
       for( var k=0; k&amp;lt;specialColumns.length; k++ )&lt;br /&gt;
&lt;br /&gt;
       {&lt;br /&gt;
&lt;br /&gt;
           column=specialColumns[k];&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#cbox_&#039;+questionId+row+&#039;_&#039;+column).change(function() {&lt;br /&gt;
&lt;br /&gt;
               action(this);&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
jQuery(document).ready(&lt;br /&gt;
&lt;br /&gt;
   function(){&lt;br /&gt;
&lt;br /&gt;
   customOnLoad();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with LimeSurvey Versions 2.06 and 2.54&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to make the last option of each Array (Numbers) (Checkboxes) row exclude all other options in the same row.&lt;br /&gt;
&lt;br /&gt;
The script will uncheck all options in a row if the last option is checked and uncheck the last option in a row if any other options are checked.&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.06:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normalOpt&#039;);&lt;br /&gt;
		$(&#039;tr.subquestions-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normalOpt:last&#039;, this).removeClass(&#039;normalOpt&#039;).addClass(&#039;exlusiveOpt&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this));&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;td.checkbox-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).click(function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normalOpt&#039;)) {&lt;br /&gt;
				$(&#039;.exlusiveOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normalOpt input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation LS Version 2.54:==&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following script in the source of the array question.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Call the exclude function using question ID&lt;br /&gt;
		excludeOpt({QID});&lt;br /&gt;
	});&lt;br /&gt;
   &lt;br /&gt;
	// A function to make the last option in each array row exclusive&lt;br /&gt;
	function excludeOpt (qID) {&lt;br /&gt;
	   &lt;br /&gt;
		var thisQuestion = $(&#039;#question&#039;+qID)&lt;br /&gt;
&lt;br /&gt;
		// Add some classes to the checkbox cells&lt;br /&gt;
		$(&#039;td.checkbox-item&#039;, thisQuestion).addClass(&#039;normal-item&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			$(&#039;.normal-item:last&#039;, this).removeClass(&#039;normal-item&#039;).addClass(&#039;exlusive-item&#039;)&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// A listener on the checkboxes&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).on(&#039;change&#039;, function (event) {&lt;br /&gt;
			handleExclusive($(this).closest(&#039;td&#039;));&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
		function handleExclusive(thisCell) {&lt;br /&gt;
			   &lt;br /&gt;
			var thisRow = $(thisCell).closest(&#039;tr&#039;);&lt;br /&gt;
&lt;br /&gt;
			// Uncheck the appropriate boxes in a row&lt;br /&gt;
			if ($(thisCell).hasClass(&#039;normal-item&#039;)) {&lt;br /&gt;
				$(&#039;.exlusive-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;.normal-item input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisRow).attr(&#039;checked&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
				&lt;br /&gt;
			// Check conditions (relevance)&lt;br /&gt;
			$(&#039;td.checkbox-item&#039;, thisRow).each(function(i) {&lt;br /&gt;
				var thisValue = &#039;&#039;;&lt;br /&gt;
				if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).is(&#039;:checked&#039;)) {&lt;br /&gt;
					thisValue = 1;&lt;br /&gt;
				}&lt;br /&gt;
				var thisSGQA = $(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, this).attr(&#039;id&#039;).replace(/cbox_/, &#039;&#039;);&lt;br /&gt;
				 &lt;br /&gt;
				$(&#039;input[type=&amp;quot;hidden&amp;quot;]&#039;, this).attr(&#039;value&#039;, thisValue);&lt;br /&gt;
				fixnum_checkconditions(thisValue, thisSGQA, &#039;hidden&#039;);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Add Navigation Buttons (Next and Previous) To Top Of Page=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.90+, IE 7/8, Firefox 3.6, Safari 3.2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following to the end of template.js. It will insert a new div after the progress bar and then insert clones of the nav buttons in the new div.&lt;br /&gt;
&lt;br /&gt;
This example is for the default template in 1.90 or 1.91. The placement of the new div may need to be modified for other templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;navigator2&amp;quot; /&amp;gt;&#039;).insertAfter(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#navigator2&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert clones of the nav buttons in the new div&lt;br /&gt;
		$(&#039;input.submit:eq(0)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
		$(&#039;input.submit:eq(2)&#039;).clone().appendTo(&#039;#navigator2&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Give the new buttons some new IDs&lt;br /&gt;
		$(&#039;#navigator2 input.submit&#039;).each(function(i) {&lt;br /&gt;
			var oldID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
			var newID = oldID + &#039;2&#039;;&lt;br /&gt;
			$(this).attr(&#039;id&#039;, newID)&lt;br /&gt;
		});&lt;br /&gt;
	});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:extra_buttons.png]]&lt;br /&gt;
&lt;br /&gt;
=How to &#039;&#039;add&#039;&#039; an opt out link to your survey=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+, Firefox 5.0&lt;br /&gt;
&lt;br /&gt;
This javascript inserts a link to opt out of the survey above the progress bar.&lt;br /&gt;
&lt;br /&gt;
[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|How to use script here]]&lt;br /&gt;
&lt;br /&gt;
Then insert the following code into to the source of a group description or a question. I used the group description.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
		// Find the survey ID&lt;br /&gt;
		if($(&#039;input#fieldnames&#039;).length != 0) {&lt;br /&gt;
			var fieldNames = $(&#039;input#fieldnames&#039;).attr(&#039;value&#039;);&lt;br /&gt;
			var tmp = fieldNames.split(&#039;X&#039;);&lt;br /&gt;
			var sID = tmp[0];&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Insert a new div after the progress bar&lt;br /&gt;
		$(&#039;&amp;lt;div id=&amp;quot;optOutLink&amp;quot; /&amp;gt;&#039;).insertBefore(&#039;#progress-wrapper&#039;);&lt;br /&gt;
&lt;br /&gt;
		// Style the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).css({&lt;br /&gt;
			&#039;text-align&#039;:&#039;center&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		// Insert opt out url in the new div&lt;br /&gt;
		$(&#039;#optOutLink&#039;).html(&#039;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;optout.php?lang=en&amp;amp;sid;=&#039;+sID+&#039;&amp;amp;token;={TOKEN}&amp;quot;&amp;gt;Click here to opt out of this survey.&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Anonymously track respondents answers across multiple surveys=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+ and 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to enable tracking of respondents across multiple surveys ensuring anonymity (it does not use tokens).&lt;br /&gt;
&lt;br /&gt;
To do this you have to use this question in all the surveys you want to link respondents answers.&lt;br /&gt;
&lt;br /&gt;
This workaround create an ID by asking some partial personal information (like initials, birth month ...). The ID will be encrypted using a one-way function (in this case SHA-1) and stored in a short text answer.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
#Optional: you can also add other select field to avoid collisions (e.g. for large population sample)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This answers are used to generate your ID. These information will be encrypted, it will not be possible in any case to identify you neither from your answers nor from your ID.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Initial of your name&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;A&amp;quot;&amp;gt;A&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;B&amp;quot;&amp;gt;B&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;C&amp;quot;&amp;gt;C&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;D&amp;quot;&amp;gt;D&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;E&amp;quot;&amp;gt;E&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;F&amp;quot;&amp;gt;F&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;G&amp;quot;&amp;gt;G&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;H&amp;quot;&amp;gt;H&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;I&amp;quot;&amp;gt;I&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;J&amp;quot;&amp;gt;J&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;K&amp;quot;&amp;gt;K&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;L&amp;quot;&amp;gt;L&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;M&amp;quot;&amp;gt;M&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;N&amp;quot;&amp;gt;N&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;O&amp;quot;&amp;gt;O&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;P&amp;quot;&amp;gt;P&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Q&amp;quot;&amp;gt;Q&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;R&amp;quot;&amp;gt;R&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;S&amp;quot;&amp;gt;S&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;T&amp;quot;&amp;gt;T&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;U&amp;quot;&amp;gt;U&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;V&amp;quot;&amp;gt;V&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;W&amp;quot;&amp;gt;W&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;X&amp;quot;&amp;gt;X&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Y&amp;quot;&amp;gt;Y&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;Z&amp;quot;&amp;gt;Z&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Your birth month&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;select id=&amp;quot;field2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;01&amp;quot;&amp;gt;January&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;02&amp;quot;&amp;gt;February&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;03&amp;quot;&amp;gt;March&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;04&amp;quot;&amp;gt;April&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;05&amp;quot;&amp;gt;May&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;06&amp;quot;&amp;gt;June&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;07&amp;quot;&amp;gt;July&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;08&amp;quot;&amp;gt;August&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;09&amp;quot;&amp;gt;September&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;10&amp;quot;&amp;gt;October&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;11&amp;quot;&amp;gt;November&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;option value=&amp;quot;12&amp;quot;&amp;gt;December&amp;lt;/option&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
   $(&amp;quot;#answer{SGQ}&amp;quot;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
   //$(&amp;quot;#answer{SGQ}&amp;quot;).css(&#039;display&#039;, &#039;none&#039;); //uncomment this line for not displaying the code&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$(&#039;#field1, #field2&#039;).bind(&#039;change keyup&#039;, function() {&lt;br /&gt;
&lt;br /&gt;
   if ($(&amp;quot;#field1&amp;quot;).val()==&#039;&#039; || $(&amp;quot;#field2&amp;quot;).val()==&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
   else {&lt;br /&gt;
&lt;br /&gt;
       var sha1 = CryptoJS.algo.SHA1.create();&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field1&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       sha1.update($(&amp;quot;#field2&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       // sha1.update($(&amp;quot;#otherfield&amp;quot;).val());&lt;br /&gt;
&lt;br /&gt;
       var hash = sha1.finalize();&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;#answer{SGQ}&amp;quot;).val(hash);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Check validity of international phone number in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&lt;br /&gt;
&lt;br /&gt;
Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an international phone number in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the phone function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       phoneTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function phoneTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var phoneMatch = /^[0-9,+,(), ,]{1,}(,[0-9]+){0,}$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid phone number.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var phoneInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(phoneInput != &#039;&#039; &amp;amp;&amp;amp; !phoneMatch.test(phoneInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1136 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Check validity of email address in subquestion=&lt;br /&gt;
&lt;br /&gt;
&#039;Tested with: 1.91+, Firefox 8, Chrome 15&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;simplebox&amp;quot;&amp;gt;As of version 1.92, you can use the core Validation querstion option to validate multiple short text and array text questions. Any question that fails that validation check will have its background color changed to red.&amp;lt;br /&amp;gt;Note, the below workaround will fail in version 1.92 because it contains a regular expression with curly braces.  However, as described above, support for this feature is now built-in to version 1.92&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This workaround uses javascript to check the validity of an email address in a subquestion of multiple short text.&lt;br /&gt;
&lt;br /&gt;
Add the following code to the source of your question.&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;QQ&amp;quot; with the question ID and &amp;quot;NN&amp;quot; with the row number that you want to validate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the email function with the question ID and the row number&lt;br /&gt;
&lt;br /&gt;
       emailTest(QQ, NN);&lt;br /&gt;
&lt;br /&gt;
       function emailTest(qID, inputNum) {&lt;br /&gt;
&lt;br /&gt;
           // Interrupt next/submit function&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#movenextbtn, #movesubmitbtn&#039;).click(function(){&lt;br /&gt;
&lt;br /&gt;
               // Some vars - modify as required&lt;br /&gt;
&lt;br /&gt;
               var emailMatch = /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9\.\_\-]*@([a-zA-Z0-9\_\-]+\.)+([a-zA-Z]{2,4}|travel|museum)$/;&lt;br /&gt;
&lt;br /&gt;
               var msg1 = &#039;Please enter a valid email address.&#039;;&lt;br /&gt;
&lt;br /&gt;
               // Test the input&lt;br /&gt;
&lt;br /&gt;
               var emailInput = $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).val();&lt;br /&gt;
&lt;br /&gt;
               if(emailInput != &#039;&#039; &amp;amp;&amp;amp; !emailMatch.test(emailInput)) {&lt;br /&gt;
&lt;br /&gt;
                   alert(msg1);&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;pink&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return false;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
               else {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; li:eq(&#039;+(inputNum-1)+&#039;) input.text&#039;).css({ &#039;background&#039;:&#039;&#039; });&lt;br /&gt;
&lt;br /&gt;
                   return true;&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The regex is from: [http://www.regexlib.com/REDetails.aspx?regexp_id=1653 regexlib.com blank]&lt;br /&gt;
&lt;br /&gt;
=Hiding the help-text when it&#039;s empty=&lt;br /&gt;
&lt;br /&gt;
Tested with: 1.91+&lt;br /&gt;
&lt;br /&gt;
I had made a style in my template putting a border around my help-text. To avoid empty help-text to show up (and have lines instead of just &#039;nothing&#039; when there was no help text, I used this piece of code in question.pstpl:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                   var questionhelp=&amp;quot;{QUESTIONHELP}&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
                   if (questionhelp==&amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                          document.write(&amp;quot;&amp;quot;);}&lt;br /&gt;
&lt;br /&gt;
                   else {&lt;br /&gt;
&lt;br /&gt;
                   document.write(&#039;&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot;&amp;gt;&#039;+ questionhelp +&#039;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#039;);}&lt;br /&gt;
&lt;br /&gt;
               &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it can probably be optimized but it worked for me&lt;br /&gt;
&lt;br /&gt;
=Disable or hide selected fields in a matrix question=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+, IE 7/8/9, FireFox 12/13&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Hide or disable selected fields in a Matrix, so that users cannot make any input.&lt;br /&gt;
&lt;br /&gt;
(See example, where users should not make input into red framed fields)&lt;br /&gt;
&lt;br /&gt;
[[File:snap035.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prevent users from input into first two fields (as an example)&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
&lt;br /&gt;
First find the name of the fields you want to hide / disable. In my case I used Firebug with firefox to figure that out.&lt;br /&gt;
&lt;br /&gt;
[[File:snap037.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 2: Figure out the name(s) of the field(s)&lt;br /&gt;
&lt;br /&gt;
Then put the following script-code into the HTML-source code as described above:&lt;br /&gt;
&lt;br /&gt;
Note: you have to change the code to match the names of your fields!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ001&amp;quot;]&#039;).attr(&#039;disabled&#039;, &#039;disabled&#039;);&lt;br /&gt;
&lt;br /&gt;
       $(&#039;input[name=&amp;quot;69965X2X10SQ001_SQ002&amp;quot;]&#039;).attr(&#039;hidden&#039;, &#039;hidden&#039;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:snap039.gif]]&lt;br /&gt;
&lt;br /&gt;
Fig. 3: Result: first field is diabled (&amp;quot;greyed out&amp;quot;), second one is completely hidden&lt;br /&gt;
&lt;br /&gt;
I think this way one can apply many other attributes to a field like color etc. But did not try that myself.&lt;br /&gt;
&lt;br /&gt;
Thanks to roB2009 for the input in the forum!&lt;br /&gt;
&lt;br /&gt;
=Add prefix or suffix to question type &amp;quot;Array (Texts)&amp;quot;=&lt;br /&gt;
&lt;br /&gt;
TASK&lt;br /&gt;
&lt;br /&gt;
Add a prefix or suffix to the text fields in questions of the &amp;quot;Array (Texts)&amp;quot; type.&lt;br /&gt;
&lt;br /&gt;
[[File:suffix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Suffix&lt;br /&gt;
&lt;br /&gt;
[[File:prefix.png]]&lt;br /&gt;
&lt;br /&gt;
Fig. 1: Prefix&lt;br /&gt;
&lt;br /&gt;
SOLUTION&lt;br /&gt;
*Set up your survey to use JavaScript.&lt;br /&gt;
*Add the following script to the source of the array. Replace &amp;quot;12345&amp;quot; with the array question ID and modify the suffixes/prefixes as required.&lt;br /&gt;
*The function call must consist of a question ID followed by the suffixes for each column. Suffixes/Prefixes must be enclosed in quotes and comma separated.&lt;br /&gt;
*In this example question ID 12345 will get an &amp;quot;in &amp;amp;euro;&amp;quot; suffix in the first column and an &amp;quot;in %&amp;quot; in the next 3 columns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   $(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       // Call the function with the question ID followed by a comma-separated list of suffixes&lt;br /&gt;
&lt;br /&gt;
       addSuffix(12345, &#039;in &amp;amp;euro;&#039;, &#039;in %&#039;, &#039;in %&#039;, &#039;in %&#039;);&lt;br /&gt;
&lt;br /&gt;
       function addSuffix() {&lt;br /&gt;
&lt;br /&gt;
           var qID = $(arguments)[0];&lt;br /&gt;
&lt;br /&gt;
           // Assign some column-specific classes&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody tr&#039;).each(function(i){&lt;br /&gt;
&lt;br /&gt;
               $(&#039;td&#039;, this).each(function(i){&lt;br /&gt;
&lt;br /&gt;
                   $(this).addClass(&#039;answerCol-&#039;+(i+1)+&#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
               });&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Some styling&lt;br /&gt;
&lt;br /&gt;
           $(&#039;#question&#039;+qID+&#039; table.question tbody input[type=&amp;quot;text&amp;quot;]&#039;).css({&lt;br /&gt;
&lt;br /&gt;
               &#039;width&#039;: &#039;50%&#039;&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
           // Insert the suffixes&lt;br /&gt;
&lt;br /&gt;
           $(arguments).each(function(i, val){&lt;br /&gt;
&lt;br /&gt;
               if(i &amp;gt; 0) {&lt;br /&gt;
&lt;br /&gt;
                   $(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&lt;br /&gt;
&lt;br /&gt;
               }&lt;br /&gt;
&lt;br /&gt;
           });&lt;br /&gt;
&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For adding a prefix you need to substitute the following line in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).append(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(&#039;#question&#039;+qID+&#039; td.answerCol-&#039;+i+&#039; label&#039;).prepend(val);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Time question (Date question-like)=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript/jQuery to build a Time question just like to the Date one.&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
#Download the file at [http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js] and upload it to your survey.&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Place the following code in the source of a short text question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script src=&amp;quot;/upload/surveys/{SID}/jquery-ui-timepicker-addon.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).timepicker({&lt;br /&gt;
			timeText: &#039;Time&#039;, //here translation&lt;br /&gt;
			hourText: &#039;hour&#039;, //here translation&lt;br /&gt;
			minuteText: &#039;minute&#039;, //here translation&lt;br /&gt;
			closeText: &#039;Done&#039; //here translation&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		$(&#039;#answer{SGQ}&#039;).attr(&#039;readonly&#039;, &#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
		$( &amp;quot;&amp;lt;style&amp;gt;&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-widget-header, .ui-datepicker-current { display:none; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }&amp;quot;&lt;br /&gt;
		+&amp;quot;.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }&amp;quot;&lt;br /&gt;
		+&amp;quot; }&amp;quot;&lt;br /&gt;
		+&amp;quot;&amp;lt;/style&amp;gt;&amp;quot;).appendTo( &amp;quot;head&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Calculating date difference=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 1.92+ Build 120909&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround explains how calculate difference between two dates (in: days, weeks, months and years) and is based on this [http://ditio.net/2010/05/02/javascript-date-difference-calculation/ resource external].&lt;br /&gt;
&lt;br /&gt;
Requieres 2 groups and &#039;group by group&#039; or &#039;question by question&#039; presentation.&lt;br /&gt;
&lt;br /&gt;
Group 1 (2 date questions)&lt;br /&gt;
*1st question - Question code: &amp;quot;DD&amp;quot;&lt;br /&gt;
*2nd question - Question code: &amp;quot;D2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Group 2&lt;br /&gt;
*1 numerical input question.&lt;br /&gt;
&lt;br /&gt;
This question retrieves the number of days between the 2 dates, and check if D2 is posterior than DD.&lt;br /&gt;
&lt;br /&gt;
All the requiered code have to be added in the source of this numerical question.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Adapted from http://ditio.net/2010/05/02/javascript-date-difference-calculation/&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
var DateDiff = {&lt;br /&gt;
&lt;br /&gt;
   inDays: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inWeeks: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var t2 = d2.getTime();&lt;br /&gt;
&lt;br /&gt;
       var t1 = d1.getTime();&lt;br /&gt;
&lt;br /&gt;
       return parseInt[[t2-t1)/(24*3600*1000*7]];&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inMonths: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       var d1Y = d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d2Y = d2.getFullYear();&lt;br /&gt;
&lt;br /&gt;
       var d1M = d1.getMonth();&lt;br /&gt;
&lt;br /&gt;
       var d2M = d2.getMonth();&lt;br /&gt;
&lt;br /&gt;
       return (d2M+12*d2Y)-(d1M+12*d1Y);&lt;br /&gt;
&lt;br /&gt;
   },&lt;br /&gt;
&lt;br /&gt;
   inYears: function(d1, d2) {&lt;br /&gt;
&lt;br /&gt;
       return d2.getFullYear()-d1.getFullYear();&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
d1 = new Date({substr(DD,0,4)}, {substr(DD,5,2)}, {substr(DD,8,2)});&lt;br /&gt;
&lt;br /&gt;
d2 = new Date({substr(D2,0,4)}, {substr(D2,5,2)}, {substr(D2,8,2)});&lt;br /&gt;
&lt;br /&gt;
// Displays result&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;days&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inDays(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;weeks&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inWeeks(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;months&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inMonths(d1, d2));&lt;br /&gt;
&lt;br /&gt;
document.write(&amp;quot;&amp;lt;br /&amp;gt;Number of &amp;lt;b&amp;gt;years&amp;lt;/b&amp;gt;: &amp;quot;+DateDiff.inYears(d1, d2));&lt;br /&gt;
&lt;br /&gt;
// filled the numerical input with number of days (or nights)&lt;br /&gt;
&lt;br /&gt;
var nDays = +DateDiff.inDays(d1, d2);&lt;br /&gt;
&lt;br /&gt;
    jQuery(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
       $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).val(nDays);&lt;br /&gt;
&lt;br /&gt;
               $(&amp;quot;.numeric:eq(0) input.text&amp;quot;).attr(&#039;readonly&#039;,&#039;readonly&#039;);&lt;br /&gt;
&lt;br /&gt;
// check if d2 &amp;gt; d1&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movenextbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               $(&#039;#movesubmitbtn&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
               if(nDays &amp;gt;= 0){&lt;br /&gt;
&lt;br /&gt;
       // automatic submit (uncomment if needed)&lt;br /&gt;
&lt;br /&gt;
               // document.limesurvey.submit();&lt;br /&gt;
&lt;br /&gt;
               // $(&#039;body&#039;).hide();&lt;br /&gt;
&lt;br /&gt;
                 }&lt;br /&gt;
&lt;br /&gt;
               else alert(&amp;quot;Check out date must be posterior than Check in\nPlease return to the previous page and edit your answers&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   });&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How to set minDate/maxDate based on other Datequestions=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; tested with Version 2.00+ Build 130708&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
QQ1 and QQ2 are the question identifiers. QQ2 gets as maxDate today and as minDate the date set in QQ1. The onClose event is needed because on document.ready the value of QQ1 is not yet known, although the value of today is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
    $(document).ready(function () {&lt;br /&gt;
        &#039;use strict&#039;;&lt;br /&gt;
        var qID1 = QQ1,&lt;br /&gt;
            qID2 = QQ2,&lt;br /&gt;
            q1 = $(&#039;#question&#039; + &#039;QQ1&#039; + &#039; .popupdate&#039;), &lt;br /&gt;
            q2 = $(&#039;#question&#039; + &#039;QQ2&#039; + &#039; .popupdate&#039;);&lt;br /&gt;
	&lt;br /&gt;
        //if q1 loses focus, its value is taken and used as minDate in q2   &lt;br /&gt;
        q1.datepicker(&amp;quot;option&amp;quot;, &amp;quot;onClose&amp;quot;, function (datum){&lt;br /&gt;
            q2.datepicker( &amp;quot;option&amp;quot;, &amp;quot;minDate&amp;quot;, datum );&lt;br /&gt;
        });&lt;br /&gt;
        //q2 gets today as its maxDate&lt;br /&gt;
        q2.datepicker( &#039;option&#039;, &#039;maxDate&#039;, new Date() );&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Remove Question Help if empty=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Version 2.00+ Build 130513&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Change your question.pstpl in your Template Editor so that the line looks like below. I&#039;ve added the ID tag help_{question_number}.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td class=&amp;quot;survey-question-help&amp;quot; id=help_{QUESTION_NUMBER}&amp;gt;{QUESTIONHELP}&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then add the following javascript at the end of question.pstpl. If the contents of the help tag is empty then hide the element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
  if($(&#039;#help_{QUESTION_NUMBER}&#039;).is(&#039;:empty&#039;)){&lt;br /&gt;
  $(&#039;#help_{QUESTION_NUMBER}&#039;).hide();&lt;br /&gt;
  }&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Implicit Association Test (IAT)=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Iat_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a [[Media:Demo_IAT_Concept.zip|working template]] and [[Media:Demo_iat_concept.lss|working survey]].&lt;br /&gt;
&lt;br /&gt;
Implementation is as follows:&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your Array (Texts) with sub-questions as follows:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Y scale - all of your &amp;quot;attribut&amp;quot; words or phrases&amp;lt;br /&amp;gt;&lt;br /&gt;
- X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Left association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Right association term&amp;lt;br /&amp;gt;&lt;br /&gt;
- Instructional text&amp;lt;br /&amp;gt;&lt;br /&gt;
- Finished text&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Iat_3.png]]&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
		&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;img[src$=&amp;quot;help.gif&amp;quot;]&#039;, thisQuestion).parent();&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.question&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iatQuestion&#039;);&lt;br /&gt;
		$(&#039;.subquestion-list&#039;).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.question&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
} &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
	background-color: #000000;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color:#0F0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color:#FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 600px;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #999;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) To apply the plugin, add one of the two scripts below to the question source:&amp;lt;br /&amp;gt;&lt;br /&gt;
- With hidden answer table (for normally activated survey)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
- With visible answer table (for testing purposes)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Version 2.50==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.50&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to insert an IAT interface into an Array (Texts) question. The workaround prompts respondents to assign words or phrases using the &amp;quot;E&amp;quot; or &amp;quot;I&amp;quot; keys. In mobile devices, &amp;quot;E&amp;quot; and &amp;quot;I&amp;quot; buttons are provided.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Demo_iat_v250.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS&#039;&#039;&#039;:&lt;br /&gt;
*Template - [[Media:Demo_IAT_For_25_Template.zip|Demo_IAT_For_25_Template.zip]] &lt;br /&gt;
*Survey - [[Media:Demo_IAT_For_25_Survey.zip|Demo_IAT_For_25_Survey.zip]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Create your Array (Texts) with sub-questions as follows:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Y scale - all of your &amp;quot;attribute&amp;quot; words or phrases&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;X scale - &amp;quot;Key Pressed&amp;quot; and &amp;quot;Elapsed Time (ms)&amp;quot;&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_2.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Insert your association terms and the other text elements for the interface into the Question Help section as depicted below. The text strings must be separated with &amp;quot;double pipes&amp;quot; (||) and you will need to place them in the following order:&lt;br /&gt;
		&amp;lt;ul&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Left association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Right association term&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Instructional text&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Finished text&amp;lt;br /&amp;gt;[[File:Demo_iat_v250_3.png]]&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;// A plugin to insert an IAT interface&lt;br /&gt;
function implicitAssociation(el, showAnswers) {&lt;br /&gt;
	&lt;br /&gt;
	$(el).each(function() {&lt;br /&gt;
			&lt;br /&gt;
		var thisQuestion = $(this);&lt;br /&gt;
		var thisQuestionHelp = $(&#039;div.question-help&#039;, thisQuestion);&lt;br /&gt;
		var thisQuestionAnswers = $(&#039;table.subquestion-list&#039;, thisQuestion).parent();&lt;br /&gt;
		var startTime = &#039;&#039;;&lt;br /&gt;
		var endTime = &#039;&#039;;	&lt;br /&gt;
		var agent = navigator.userAgent.toLowerCase();&lt;br /&gt;
		var mobile = false;&lt;br /&gt;
		if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices&lt;br /&gt;
			mobile = true;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Some classes&lt;br /&gt;
		$(thisQuestion).addClass(&#039;iat-question&#039;);&lt;br /&gt;
		$(&#039;tr.subquestion-list&#039;, thisQuestion).addClass(&#039;unanswered&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Hide the question help element&lt;br /&gt;
		$(thisQuestionHelp).hide();&lt;br /&gt;
		$(thisQuestionHelp).closest(&#039;.question-help-container&#039;).hide();&lt;br /&gt;
		&lt;br /&gt;
		// Hide the answers&lt;br /&gt;
		if(showAnswers != true) {&lt;br /&gt;
			$(&#039;table.subquestion-list&#039;, thisQuestion).hide();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Insert IAT display&lt;br /&gt;
		var iatTexts = $(thisQuestionHelp).text().split(&#039;||&#039;);&lt;br /&gt;
		var iatDisplayHTML = &#039;&amp;lt;div class=&amp;quot;iatWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatLeftLabel&amp;quot;&amp;gt;&#039;+iatTexts[0]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatRightLabel&amp;quot;&amp;gt;&#039;+iatTexts[1]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatWord&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatInstructions&amp;quot;&amp;gt;&#039;+iatTexts[2]+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;div class=&amp;quot;iatMobileButtonWrapper&amp;quot;&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatLeftButton&amp;quot;&amp;gt;E&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div class=&amp;quot;iatButton iatRightButton&amp;quot;&amp;gt;I&amp;lt;/div&amp;gt;\&lt;br /&gt;
								&amp;lt;div style=&amp;quot;width:100%; clear:both;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
							&amp;lt;/div&amp;gt;&#039;;&lt;br /&gt;
		$(thisQuestionAnswers).prepend(iatDisplayHTML);&lt;br /&gt;
		&lt;br /&gt;
		// Show a word&lt;br /&gt;
		function iatShowWord() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(document).bind(&#039;keypress.iatKeypress&#039;, function(e) {&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
					$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
					endTime = new Date();&lt;br /&gt;
					$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
					if(e.which == 101) {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;E&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val(&#039;I&#039;);&lt;br /&gt;
					}&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatKeypress&#039;);&lt;br /&gt;
					if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
						iatShowWord();&lt;br /&gt;
					}&lt;br /&gt;
					else {&lt;br /&gt;
						$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
							$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
							$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
						});&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		function iatShowWordMobile() {&lt;br /&gt;
			$(&#039;div.iatWord&#039;, thisQuestion).text($(&#039;tr.subquestion-list.unanswered:first .answertext&#039;, thisQuestion).text());&lt;br /&gt;
			startTime = new Date();&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatButtonClick&#039;, function(e) {&lt;br /&gt;
				var thisRow = $(&#039;tr.subquestion-list.unanswered:eq(0)&#039;, thisQuestion);&lt;br /&gt;
				$(thisRow).removeClass(&#039;unanswered&#039;);&lt;br /&gt;
				endTime = new Date();&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(1)&#039;, thisRow).val(endTime.valueOf() - startTime.valueOf());&lt;br /&gt;
				$(&#039;input[type=&amp;quot;text&amp;quot;]:eq(0)&#039;, thisRow).val($(this).text());&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatButtonClick&#039;);&lt;br /&gt;
				if($(&#039;tr.subquestion-list.unanswered&#039;, thisQuestion).length &amp;gt; 0) {&lt;br /&gt;
					iatShowWordMobile();&lt;br /&gt;
				}&lt;br /&gt;
				else {&lt;br /&gt;
					$(&#039;.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper&#039;, thisQuestion).fadeOut(&#039;slow&#039;, function() {&lt;br /&gt;
						$(&#039;div.iatWord&#039;, thisQuestion).text(iatTexts[3]);&lt;br /&gt;
						$(&#039;.iatWord&#039;, thisQuestion).addClass(&#039;done&#039;).fadeIn(&#039;slow&#039;);&lt;br /&gt;
					});&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		// Start the IAT display&lt;br /&gt;
		if(mobile == true) { // Mobile devices&lt;br /&gt;
			$(&#039;.iatMobileButtonWrapper&#039;, thisQuestion).show();&lt;br /&gt;
			$(&#039;.iatButton&#039;, thisQuestion).bind(&#039;click.iatStartMobile&#039;, function(e) {&lt;br /&gt;
				$(&#039;.iatButton&#039;, thisQuestion).unbind(&#039;click.iatStartMobile&#039;);&lt;br /&gt;
				iatShowWordMobile();&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(document).bind(&#039;keypress.iatStart&#039;, function(e) { // Non-mobile devices&lt;br /&gt;
				if(e.which == 101 || e.which == 105) {&lt;br /&gt;
					$(document).unbind(&#039;keypress.iatStart&#039;);&lt;br /&gt;
					iatShowWord();&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/* IAT questions */&lt;br /&gt;
&lt;br /&gt;
.iatWrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	height: 300px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	color: #D0DBE5;&lt;br /&gt;
	background-color: #2C3E50;&lt;br /&gt;
	font-size: 21px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftLabel {&lt;br /&gt;
	float: left;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightLabel {&lt;br /&gt;
	float: right;&lt;br /&gt;
	padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	top: 35%;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatWord.done {&lt;br /&gt;
	color: #C4D1DE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatInstructions {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	bottom: 0px;&lt;br /&gt;
	padding-bottom: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatMobileButtonWrapper {&lt;br /&gt;
	display: none;&lt;br /&gt;
	position: relative;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 600px;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	font-size: 36px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin: 20px;&lt;br /&gt;
	width: 100px;&lt;br /&gt;
	padding: 2px 0 5px 0;&lt;br /&gt;
	border: 5px solid #233140;&lt;br /&gt;
	-moz-border-radius: 10px;&lt;br /&gt;
	-webkit-border-radius: 10px;&lt;br /&gt;
	-khtml-border-radius: 10px;&lt;br /&gt;
	border-radius: 10px;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatLeftButton {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.iatRightButton {&lt;br /&gt;
	float: right;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
	&amp;lt;li&amp;gt;To apply the plugin, add one of the two scripts below to the question source:&lt;br /&gt;
		&amp;lt;ul&amp;gt;		&lt;br /&gt;
			&amp;lt;li&amp;gt;With hidden answer table (for normally activated survey)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;	&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;With visible answer table (for testing purposes)&lt;br /&gt;
			&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		// Apply the IAT plugin to this question&lt;br /&gt;
		implicitAssociation(&#039;#question{QID}&#039;, true);&lt;br /&gt;
	});	&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/ul&amp;gt;&lt;br /&gt;
	&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Make multiple choice easier=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with Version 2.00 in Chrome, FF, Safar, IE&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The problem:&lt;br /&gt;
We often have multiple choice question, where the user has to select 4 elements out of 78 possible answers or 3 out of 25 and so on.&lt;br /&gt;
If we use pen and paper version for this questions, we noticed that the participants go through the whole list and if an answer doesn&#039;t suit on the first sight, they cross it out.&lt;br /&gt;
&lt;br /&gt;
The solution:&lt;br /&gt;
The script gives the participant the possibility to cross out this answers in a digital way. The script adds a small &amp;quot;X&amp;quot; before the checkbox. When it is clicked, the label text of the checkbox turns grey.&lt;br /&gt;
(see the attached screenshot for an example)&lt;br /&gt;
&lt;br /&gt;
Here is the script, just add it to help text&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
* Small script that adds a &amp;quot;X&amp;quot; before a checkbox. &lt;br /&gt;
* On click the text color of the label of the checkbox turns grey&lt;br /&gt;
* If the user has to choose some answers from many options, he can &amp;quot;delete&amp;quot; answers, that on first sight looks wrong&lt;br /&gt;
* Add the script to the question in Limesurvey (for example within the source code of the help text)&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
//Define the X (standard is a X in capitals)&lt;br /&gt;
var x = &amp;quot;X&amp;quot;;&lt;br /&gt;
css_class = &amp;quot;x&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
/*&lt;br /&gt;
* Define the style of the X&lt;br /&gt;
* Of course you can define the style in the stylesheet - if so, the script ignores the following settings&lt;br /&gt;
* If there is a style, than set style var to 1&lt;br /&gt;
*/&lt;br /&gt;
var style = 0;&lt;br /&gt;
var size = &amp;quot;12px&amp;quot;;&lt;br /&gt;
var weight = &amp;quot;bold&amp;quot;;&lt;br /&gt;
var color = &amp;quot;red&amp;quot;;&lt;br /&gt;
var cursor = &amp;quot;pointer&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//element type - standard is a span element&lt;br /&gt;
var type = &amp;quot;span&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Define the new font color of the checkbox label&lt;br /&gt;
label_color = &amp;quot;#bfbfbf&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
//End of configuration - start of the function&lt;br /&gt;
 &lt;br /&gt;
//Define the element that is added&lt;br /&gt;
if(style == 1) {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
	ele = &amp;quot;&amp;lt;&amp;quot;+type+&amp;quot; class=&#039;&amp;quot;+css_class+&amp;quot;&#039; style=&#039;font-size:&amp;quot;+size+&amp;quot;; font-weight:&amp;quot;+weight+&amp;quot;; color:&amp;quot;+color+&amp;quot;; cursor:&amp;quot;+cursor+&amp;quot;;&#039;&amp;gt;&amp;quot;+x+&amp;quot;&amp;lt;/&amp;quot;+type+&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
//Get the standard font-color of the used style&lt;br /&gt;
st_color = $(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
//insert the X before the checkboxes&lt;br /&gt;
$(document).ready(function() { &lt;br /&gt;
	$(&amp;quot;li&amp;quot;).each(function(){&lt;br /&gt;
		$(this).prepend(ele);&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
//bind an eventhandler on the X (delegate is used, because Limesurvey uses an old jQuery version)&lt;br /&gt;
var css_class_c = &amp;quot;.&amp;quot;+css_class;&lt;br /&gt;
$(document).delegate(css_class_c,&amp;quot;click&amp;quot;,function() {&lt;br /&gt;
	var color_check = $(this).siblings(&amp;quot;label&amp;quot;).data(&amp;quot;color&amp;quot;);&lt;br /&gt;
	if(color_check != &amp;quot;true&amp;quot;) {&lt;br /&gt;
    	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,label_color).data(&amp;quot;color&amp;quot;,&amp;quot;true&amp;quot;);&lt;br /&gt;
    	$(this).siblings(&#039;input&#039;).attr(&#039;checked&#039;, false);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
	}&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
$(&amp;quot;.checkbox&amp;quot;).click(function () {&lt;br /&gt;
	$(this).siblings(&amp;quot;label&amp;quot;).css(&amp;quot;color&amp;quot;,st_color).data(&amp;quot;color&amp;quot;,&amp;quot;false&amp;quot;);&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Prevent the survey from being submitted when users press enter=&lt;br /&gt;
&lt;br /&gt;
By default HTML forms are submitted when the user presses enter in any text field. This can be annoying with long survey pages or if your users are inexperienced with keyboard shortcuts.&lt;br /&gt;
&lt;br /&gt;
To disable this behavior, add the following code snippet to template.js:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).ready(function(){&lt;br /&gt;
    $(&#039;input&#039;).keypress(&lt;br /&gt;
    function(event){&lt;br /&gt;
     if (event.which == &#039;13&#039;) {&lt;br /&gt;
        event.preventDefault();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Card Sorting=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome, iPad&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to allow dragging items into &amp;quot;buckets&amp;quot; to &amp;quot;card sort&amp;quot; them. A multiple-short-text question is used with sub-questions being the draggable items. The data recorded for each item is the &amp;quot;bucket&amp;quot; number that it was dropped in. &amp;quot;Buckets&amp;quot; are pre-defined in a list in the &amp;quot;Help&amp;quot; section of the question.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Card_sort_1.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DOWNLOADS:&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.zip|Demo template]]&amp;lt;br /&amp;gt;&lt;br /&gt;
- [[Media:Card_Sort.lss|Demo survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) [[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
&lt;br /&gt;
2) Create your multiple-short-text with sub-questions.&lt;br /&gt;
&lt;br /&gt;
3) Insert the &amp;quot;bucket&amp;quot; labels into an unordered list in the Question Help section.&lt;br /&gt;
&lt;br /&gt;
4) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
function cardSort(qID) {&lt;br /&gt;
 &lt;br /&gt;
	// Define some stuff...&lt;br /&gt;
	var thisQuestion = $(&#039;#question&#039;+qID);&lt;br /&gt;
	var thisQuestionHelp = $(&#039;img[alt=&amp;quot;Help&amp;quot;]&#039;, thisQuestion).parent();	&lt;br /&gt;
	thisQuestion.addClass(&#039;card-sort-question&#039;);&lt;br /&gt;
 &lt;br /&gt;
	// Hide the &amp;quot;Help&amp;quot; section&lt;br /&gt;
	thisQuestionHelp.hide();&lt;br /&gt;
 &lt;br /&gt;
	//Insert the &amp;quot;card sort&amp;quot; elements&lt;br /&gt;
	$(&#039;ul.questions-list&#039;, thisQuestion).parent().prepend(&#039;&amp;lt;div class=&amp;quot;droppable items-start&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div class=&amp;quot;items-end-wrapper&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
	$(&#039;ul:eq(0) li&#039;, thisQuestionHelp).each(function(i) {&lt;br /&gt;
		$(&#039;.items-end-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;items-end-inner&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;items-end-text&amp;quot;&amp;gt;&#039;+$(this).html()+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;droppable items-end items-end-&#039;+(i+1)+&#039;&amp;quot; data-items-end=&amp;quot;&#039;+(i+1)+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&#039;)});&lt;br /&gt;
 &lt;br /&gt;
	// Insert the &amp;quot;cards&amp;quot;&lt;br /&gt;
	$(&#039;li.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		var thisSGQA = $(this).attr(&#039;id&#039;).replace(/javatbd/, &#039;&#039;);&lt;br /&gt;
		var thisCode = $(this).attr(&#039;id&#039;).split(&#039;X&#039;+qID)[1];&lt;br /&gt;
		var thisHTML = $(&#039;label&#039;, this).html();&lt;br /&gt;
		$(&#039;div.items-start&#039;).append(&#039;&amp;lt;div class=&amp;quot;card draggable&amp;quot; data-sgqa=&amp;quot;&#039;+thisSGQA+&#039;&amp;quot; data-code=&amp;quot;&#039;+thisCode+&#039;&amp;quot;&amp;gt;\&lt;br /&gt;
										&#039;+thisHTML+&#039;\&lt;br /&gt;
									&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
	});			&lt;br /&gt;
 &lt;br /&gt;
	// Make the &amp;quot;cards&amp;quot; draggable&lt;br /&gt;
	$(&#039;.draggable&#039;).draggable({ &lt;br /&gt;
		revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
		zIndex: 2700, &lt;br /&gt;
		helper: &#039;original&#039;,&lt;br /&gt;
		start: function( event, ui ) {&lt;br /&gt;
			$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
		},&lt;br /&gt;
		stop: function( event, ui ) {&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Set the targets for the draggables&lt;br /&gt;
	$(&#039;.droppable.items-start&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable.moved&#039; &lt;br /&gt;
	});&lt;br /&gt;
	$(&#039;.droppable.items-end&#039;).droppable({ &lt;br /&gt;
		hoverClass: &#039;target-hover&#039;, &lt;br /&gt;
		accept: &#039;.draggable&#039; &lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// After dropped&lt;br /&gt;
	$(&#039;.droppable&#039;).bind(&#039;drop&#039;, function(event, ui) {&lt;br /&gt;
 &lt;br /&gt;
		// Physically move the draggable to the target &lt;br /&gt;
		// (the plugin just visually moves it)&lt;br /&gt;
		// (need to use a clone here to fake out iPad)&lt;br /&gt;
		var newDraggable = $(ui.draggable).clone();&lt;br /&gt;
		$(newDraggable).appendTo(this);&lt;br /&gt;
		$(ui.draggable).remove();&lt;br /&gt;
		if($(this).hasClass(&#039;items-end&#039;)) {&lt;br /&gt;
			$(newDraggable).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			$(newDraggable).removeClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
		$(newDraggable).removeClass(&#039;ui-draggable-helper ui-draggable-dragging&#039;).css({&lt;br /&gt;
			&#039;z-index&#039;:&#039;&#039;,&lt;br /&gt;
			&#039;top&#039;:&#039;auto&#039;, &lt;br /&gt;
			&#039;left&#039;:&#039;auto&#039;&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Now, make this new clone draggable&lt;br /&gt;
		$(newDraggable).draggable({ &lt;br /&gt;
			revert: &amp;quot;invalid&amp;quot;, &lt;br /&gt;
			zIndex: 2700, &lt;br /&gt;
			helper: &#039;original&#039;,&lt;br /&gt;
			start: function( event, ui ) {&lt;br /&gt;
				$(ui.helper).addClass(&#039;ui-draggable-helper&#039;);&lt;br /&gt;
			},&lt;br /&gt;
			stop: function( event, ui ) {&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Initial &amp;quot;card&amp;quot; positions&lt;br /&gt;
	$(&#039;li.question-item input.text&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
		if($(this).val() &amp;gt; 0) {&lt;br /&gt;
			$(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;).append($(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;));&lt;br /&gt;
			$(&#039;.card[data-sgqa=&amp;quot;&#039;+$(this).attr(&#039;name&#039;)+&#039;&amp;quot;]&#039;).appendTo($(&#039;.items-end[data-items-end=&amp;quot;&#039;+$(this).val()+&#039;&amp;quot;]&#039;)).addClass(&#039;moved&#039;);&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
 &lt;br /&gt;
	// Interrupt the Next/Submit function and load the inputs&lt;br /&gt;
	$(&#039;form#limesurvey&#039;).submit(function(){&lt;br /&gt;
		$(&#039;.question-item input.text&#039;, thisQuestion).val(0);&lt;br /&gt;
		$(&#039;.droppable.items-end .card&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
			var thisItemsEnd = $(this).closest(&#039;.droppable.items-end&#039;).attr(&#039;data-items-end&#039;);&lt;br /&gt;
			var thisID = $(this).attr(&#039;data-sgqa&#039;);&lt;br /&gt;
			$(&#039;#answer&#039;+thisID+&#039;&#039;).val(thisItemsEnd);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;5) Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/* Card Sort */&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question ul.subquestions-list {&lt;br /&gt;
	/*display: none;&lt;br /&gt;
	clear: both;*/&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start {&lt;br /&gt;
	float: left;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
	height: 317px;&lt;br /&gt;
	margin-top: 8px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-start.target-hover {&lt;br /&gt;
	background:#C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-wrapper {&lt;br /&gt;
	float: left;&lt;br /&gt;
	margin-left: 20px;&lt;br /&gt;
	width: 340px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	min-height: 73px;&lt;br /&gt;
	margin-bottom: 10px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	border: 1px solid #666;&lt;br /&gt;
	-moz-border-radius: 6px;&lt;br /&gt;
	-webkit-border-radius: 6px;&lt;br /&gt;
	-khtml-border-radius: 6px;&lt;br /&gt;
	border-radius: 6px;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.target-hover {&lt;br /&gt;
	background: #C9C9C9;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end.ui-state-disabled {&lt;br /&gt;
    opacity: 1;&lt;br /&gt;
	filter:alpha(opacity=100);&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end-text {&lt;br /&gt;
	width: 338px;&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
	background: #FFFFFF;&lt;br /&gt;
	font-size: 110%;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .card  {&lt;br /&gt;
	display: inline-block;&lt;br /&gt;
	width: 140px;&lt;br /&gt;
	height: auto;&lt;br /&gt;
	margin: 5px 8px;&lt;br /&gt;
	padding: 3px;&lt;br /&gt;
    border: 2px solid #2F4354;&lt;br /&gt;
	-moz-border-radius: 8px;&lt;br /&gt;
	-webkit-border-radius: 8px;&lt;br /&gt;
	-khtml-border-radius: 8px;&lt;br /&gt;
	border-radius: 8px;&lt;br /&gt;
	background-color: #43b3d1;&lt;br /&gt;
	color: #2f4354;&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	line-height: normal;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question .items-end .card  {&lt;br /&gt;
	margin: 5px 7px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.card-sort-question  div.answer {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	padding-top: 1px;&lt;br /&gt;
	margin-top: 0;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;6) Add this to the source of the question to apply the function.&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;	&lt;br /&gt;
	$(document).ready(function() {&lt;br /&gt;
		cardSort({QID});&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Text Input (e.g. &amp;quot;short free text&amp;quot;, &amp;quot;huge free text&amp;quot;): Force UpperCase + onBlur Trim=&lt;br /&gt;
&lt;br /&gt;
Add this to the source of your target question to apply the function.&lt;br /&gt;
&lt;br /&gt;
Here is the primary JavaScript/jQuery coding:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;script type=&#039;text/javascript&#039; charset=&#039;utf-8&#039;&amp;gt;&lt;br /&gt;
$( document ).ready( function() {&lt;br /&gt;
	var this_surveyId=&#039;{SID}&#039;;&lt;br /&gt;
	var this_groupId=&#039;{self.gid}&#039;;&lt;br /&gt;
	var this_quesitonId=&#039;{self.qid}&#039;;&lt;br /&gt;
	var this_self=&#039;{self.sgqa}&#039;;&lt;br /&gt;
&lt;br /&gt;
	// Remark for the variable &#039;my_targetTextBox&#039;:&lt;br /&gt;
	// ------------------------------------&lt;br /&gt;
	// For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self;&lt;br /&gt;
	// For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, use : &#039;#answer&#039; + this_self + &#039;text&#039;.&lt;br /&gt;
	var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//	Trim:&lt;br /&gt;
//	-----&lt;br /&gt;
	$( my_targetTextBox ).blur( function(){&lt;br /&gt;
		$( this ).val( $.trim( $( this ).val() ) );&lt;br /&gt;
	});&lt;br /&gt;
&lt;br /&gt;
//	Uppercase:&lt;br /&gt;
//	----------&lt;br /&gt;
	// Operate for its appearance only (but have no effect to modify its intrinsic value) - display as UpperCase:&lt;br /&gt;
	$( my_targetTextBox ).css( &#039;text-transform&#039;, &#039;uppercase&#039; );&lt;br /&gt;
	// Operate for its intrinsic value:&lt;br /&gt;
	$( my_targetTextBox ).blur( function() {&lt;br /&gt;
		$( this ).val( $( this ).val().toUpperCase() );&lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Text-type question (e.g. &#039;short free text&#039;, &#039;huge free text&#039;), set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &#039;Multiple Choice&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &#039;List (radio)&#039;-type question enabled with the &#039;Other&#039; option which provides a textbox, set the &#039;this_self&#039; variable as below:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
var my_targetTextBox=&#039;#answer&#039; + this_self + &#039;text&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Convert arrays to dropdowns on smaller screens =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: 2.05, IE 8-11, Firefox, Chrome&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little jQuery plugin that converts arrays to drop-downs on smaller screens.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPLEMENTATION:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1) Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray();&lt;br /&gt;
});&lt;br /&gt;
 &lt;br /&gt;
/***** &lt;br /&gt;
    A plugin to insert drop-downs into arrays for small screens&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
    $.fn.responsiveArray = function(options) {&lt;br /&gt;
    &lt;br /&gt;
        var opts = $.extend( {&lt;br /&gt;
            chooseText: &#039;Please choose...&#039;            &lt;br /&gt;
        }, options);&lt;br /&gt;
 &lt;br /&gt;
        return this.each(function() {&lt;br /&gt;
 &lt;br /&gt;
            var thisQuestion = $(this);&lt;br /&gt;
            var thisQID = $(thisQuestion).attr(&#039;id&#039;).split(&#039;question&#039;)[1];&lt;br /&gt;
&lt;br /&gt;
            // Some classes&lt;br /&gt;
            $(thisQuestion).addClass(&#039;responsive-array&#039;);&lt;br /&gt;
            $(&#039;table.questions-list tr&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;&amp;gt; *&#039;, this).each(function(i){&lt;br /&gt;
                    $(this).addClass(&#039;col-&#039;+i);&lt;br /&gt;
                    if(i != 0) {&lt;br /&gt;
                        $(this).addClass(&#039;expanded&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                });&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Insert a column&lt;br /&gt;
            $(&#039;.col-0&#039;, thisQuestion).after(&#039;&amp;lt;td class=&amp;quot;dropdown-cell&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
&lt;br /&gt;
            // Insert dropdowns&lt;br /&gt;
            $(&#039;body&#039;).append(&#039;&amp;lt;select style=&amp;quot;display:none;&amp;quot; class=&amp;quot;responsive-select responsive-select-&#039;+thisQID+&#039;&amp;quot; /&amp;gt;&#039;);&lt;br /&gt;
            $(&#039;table.questions-list thead th.expanded&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                $(&#039;.responsive-select-&#039;+thisQID).append(&#039;&amp;lt;option value=&amp;quot;&amp;quot;&amp;gt;&#039;+$(this).text()+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;table.questions-list tbody .dropdown-cell&#039;, thisQuestion).append($(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).clone());&lt;br /&gt;
            $(&#039;tr.radio-list&#039;, thisQuestion).each(function(i){&lt;br /&gt;
                var thisRow = $(this);&lt;br /&gt;
                $(&#039;input.radio&#039;, this).each(function(i){&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039; option:eq(&#039;+i+&#039;)&#039;, thisRow).attr(&#039;value&#039;, $(this).attr(&#039;id&#039;));&lt;br /&gt;
                });                    &lt;br /&gt;
                if($(&#039;input.radio:checked&#039;, thisRow).length &amp;gt; 0) {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).val($(&#039;input.radio:checked&#039;, thisRow).attr(&#039;id&#039;));&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                    $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisRow).prepend(&#039;&amp;lt;option value=&amp;quot;&amp;quot; selected=&amp;quot;selected&amp;quot;&amp;gt;&#039;+opts.chooseText+&#039;&amp;lt;/option&amp;gt;&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;, thisQuestion).show();&lt;br /&gt;
&lt;br /&gt;
            // Listeners on radios&lt;br /&gt;
            $(&#039;input.radio&#039;, thisQuestion).click(function(event) {&lt;br /&gt;
                var thisRow = $(this).closest(&#039;tr&#039;);&lt;br /&gt;
                var thisID = $(this).attr(&#039;id&#039;);&lt;br /&gt;
                //$(&#039;option[value=&amp;quot;&#039;+thisID+&#039;&amp;quot;]&#039;).attr(&#039;selected&#039;, &#039;selected&#039;);&lt;br /&gt;
                $(&#039;.responsive-select&#039;, thisRow).val(thisID);&lt;br /&gt;
                $(&#039;.responsive-select option[value=&amp;quot;&amp;quot;]&#039;, thisRow).remove();&lt;br /&gt;
            });&lt;br /&gt;
&lt;br /&gt;
            // Listeners on dropdowns&lt;br /&gt;
            $(&#039;.responsive-select-&#039;+thisQID+&#039;&#039;).change(function() {&lt;br /&gt;
                $(&#039;#&#039;+$(this).val()+&#039;&#039;).click();&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        });&lt;br /&gt;
    };&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;2) Add something like this to template.css (I have it set to switch at 640px but adjust that as you see fit):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
/***** &lt;br /&gt;
    Styles for the responsiveArray plugin&lt;br /&gt;
    Copyright (C) 2015 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 09/04/15&lt;br /&gt;
*****/&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell {&lt;br /&gt;
    display: none;&lt;br /&gt;
    text-align: left;&lt;br /&gt;
    padding-left: 8px;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
.responsive-array .dropdown-cell select {&lt;br /&gt;
        max-width: none;&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
@media screen and (max-width: 640px) {&lt;br /&gt;
    .responsive-array table.question {&lt;br /&gt;
        table-layout: auto;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array table.question .col-0,&lt;br /&gt;
    .responsive-array table.question .dropdown-cell {&lt;br /&gt;
        width: 50%;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array .dropdown-cell {&lt;br /&gt;
        display: table-cell;&lt;br /&gt;
    }&lt;br /&gt;
    .responsive-array th.expanded,&lt;br /&gt;
    .responsive-array td.expanded {&lt;br /&gt;
        display: none;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;Note that the &amp;quot;Please choose&amp;quot; text is an optional setting. To change it, apply the plugin like this:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&lt;br /&gt;
$(document).ready(function(){&lt;br /&gt;
    // Apply the responsiveArray plugin with default settings&lt;br /&gt;
    $(&#039;.array-10-pt, .array-flexible-row, .array-5-pt, .array-increase-same-decrease, .array-yes-uncertain-no&#039;).responsiveArray({&lt;br /&gt;
        chooseText: &#039;Select one...&#039;&lt;br /&gt;
    });&lt;br /&gt;
});&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Van Westendorp Pricing Sliders=&lt;br /&gt;
== Version 2.06==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.06&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_206_v2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_206.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;li.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;li.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).attr(&#039;data-slider&#039;, (i+1));&lt;br /&gt;
				&lt;br /&gt;
				var thisSliderMin = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
				var thisSliderMax = $(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;);&lt;br /&gt;
				$(&#039;.ui-slider&#039;, this).slider(&#039;option&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;ul.subquestions-list&#039;, thisQuestion).append($(&#039;li.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slide&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;.ui-slider&#039;, thisQuestion).on(&#039;slidestop&#039;, function(event, ui) {&lt;br /&gt;
				handleVwpSliders(this, ui.value);&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var thisRow = $(el).closest(&#039;li&#039;);&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider&#039;);&lt;br /&gt;
				&lt;br /&gt;
				$(&#039;input.text&#039;, thisRow).val(sliderVal);&lt;br /&gt;
				$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;.ui-slider&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).slider(&#039;option&#039;, &#039;value&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;li&#039;);&lt;br /&gt;
						$(this).slider(&#039;option&#039;, &#039;value&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;input.text&#039;, thisRow).val(newSliderVal);&lt;br /&gt;
						$(&#039;.slider-callout&#039;, thisRow).html($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of [http://extensions.sondages.pro/skeletonquest-rwd-for-limesurvey/ Denis Chenu&#039;s SkeletonQuest template]):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/**** Van Westendorp Pricing ****/&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list,&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
    display:block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list li {&lt;br /&gt;
	margin-bottom: 15px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question ul.subquestions-list .slider-label {&lt;br /&gt;
    display:block;&lt;br /&gt;
    padding: 0.3em 0.5em 0.7em;&lt;br /&gt;
    width: auto;&lt;br /&gt;
	max-width: 100%;&lt;br /&gt;
	text-align: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-element {&lt;br /&gt;
    display: block;&lt;br /&gt;
	margin-left: 2%;&lt;br /&gt;
	width:90%;&lt;br /&gt;
	max-width: 32em;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Version 2.5x==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.54.5&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This workaround uses JavaScript to dynamically control sliders to facilitate the [http://www.5circles.com/van-westendorp-pricing-the-price-sensitivity-meter/ Van Westendorp pricing research methodology]. When a slider is manipulated, all of the &amp;quot;higher&amp;quot; sliders are dynamically pushed to higher levels and &amp;quot;lower&amp;quot; sliders are pushed to lower levels. This ensures that the data will always be valid.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Test_Van_Westendorp_Pricing_25x.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Test_Van_Westendorp_Pricing_25x.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Numeric question with sub-questions as seen in the image above.&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;function shuffleArray(array) {&lt;br /&gt;
	for (var i = array.length - 1; i &amp;gt; 0; i--) {&lt;br /&gt;
		var j = Math.floor(Math.random() * (i + 1));&lt;br /&gt;
		var temp = array[i];&lt;br /&gt;
		array[i] = array[j];&lt;br /&gt;
		array[j] = temp;&lt;br /&gt;
	}&lt;br /&gt;
	return array;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to facilitate the Van Westendorp pricing research methodology&lt;br /&gt;
    Copyright (C) 2016 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 2.0&lt;br /&gt;
    Create date - 19/10/16&lt;br /&gt;
*****/&lt;br /&gt;
(function( $ ){&lt;br /&gt;
&lt;br /&gt;
	$.fn.vWPricing25 = function(options) {  &lt;br /&gt;
	&lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		}, options);&lt;br /&gt;
		&lt;br /&gt;
		return this.each(function() { &lt;br /&gt;
				&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
			&lt;br /&gt;
			thisQuestion.addClass(&#039;vwp-question&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Add some attributes and set the slider max/min values&lt;br /&gt;
			var itemsLength = $(&#039;.question-item&#039;, thisQuestion).length;&lt;br /&gt;
			$(&#039;.question-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisInput = $(&#039;input[type=text]&#039;, this);&lt;br /&gt;
				var thisVal = $(thisInput).val();&lt;br /&gt;
				&lt;br /&gt;
				$(this).attr(&#039;data-item&#039;, (i+1));&lt;br /&gt;
				$(thisInput).attr(&#039;data-slider-index&#039;, (i+1));&lt;br /&gt;
		&lt;br /&gt;
				// Slider initial settings&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					var thisSliderMin = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;min&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;min&#039;, thisSliderMin+(i));&lt;br /&gt;
					var thisSliderMax = $(thisInput).bootstrapSlider(&#039;getAttribute&#039;, &#039;max&#039;);&lt;br /&gt;
					$(thisInput).bootstrapSlider(&#039;setAttribute&#039;, &#039;max&#039;, thisSliderMax-((itemsLength-1)-i));&lt;br /&gt;
					&lt;br /&gt;
					if(thisVal == &#039;&#039;) {&lt;br /&gt;
						$(thisInput).val(&#039;&#039;);&lt;br /&gt;
					}&lt;br /&gt;
				}, 200);&lt;br /&gt;
				&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// Slider order&lt;br /&gt;
			if(opts.randomOrder == true) {&lt;br /&gt;
				shuffleArray(opts.order);&lt;br /&gt;
			}&lt;br /&gt;
			$(opts.order).each(function(i, val) {&lt;br /&gt;
				$(&#039;.subquestion-list.questions-list&#039;, thisQuestion).append($(&#039;.question-item[data-item=&amp;quot;&#039;+val+&#039;&amp;quot;]&#039;, thisQuestion));&lt;br /&gt;
			});&lt;br /&gt;
	&lt;br /&gt;
			// Listeners on the sliders&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slide&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});	&lt;br /&gt;
			$(&#039;input[type=text]&#039;, thisQuestion).on(&#039;slideStop&#039;, function(event) {&lt;br /&gt;
				handleVwpSliders(this, $(this).bootstrapSlider(&#039;getValue&#039;));&lt;br /&gt;
			});&lt;br /&gt;
			&lt;br /&gt;
			// A function to handle the siders&lt;br /&gt;
			function handleVwpSliders(el, sliderVal) {&lt;br /&gt;
				var movedIndexNum = $(el).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
				&lt;br /&gt;
				var lowerSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;lt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				var higherSliders = $(&#039;input[type=text]&#039;, thisQuestion).filter(function() {&lt;br /&gt;
					return $(this).attr(&#039;data-slider-index&#039;) &amp;gt; movedIndexNum;&lt;br /&gt;
				});&lt;br /&gt;
				&lt;br /&gt;
				$(lowerSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal-(movedIndexNum-thisIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;gt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
				$(higherSliders).each(function(i) {&lt;br /&gt;
					var thisIndexNum = $(this).attr(&#039;data-slider-index&#039;);&lt;br /&gt;
					var newSliderVal = sliderVal+(thisIndexNum-movedIndexNum);&lt;br /&gt;
					if($(this).bootstrapSlider(&#039;getValue&#039;) &amp;lt; newSliderVal) {&lt;br /&gt;
						var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
						var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
						$(this).bootstrapSlider(&#039;setValue&#039;, newSliderVal);&lt;br /&gt;
						$(&#039;.tooltip-inner&#039;, thisTooltip).text($(&#039;input.text&#039;, thisRow).val());&lt;br /&gt;
						thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						&lt;br /&gt;
						var validationInput =  $(&#039;input.em_sq_validation&#039;, thisRow);&lt;br /&gt;
						$(validationInput).val($(&#039;input.text&#039;, thisRow).val())&lt;br /&gt;
						fixnum_checkconditions($(validationInput).attr(&#039;value&#039;), $(validationInput).attr(&#039;name&#039;), $(validationInput).attr(&#039;type&#039;));&lt;br /&gt;
					}&lt;br /&gt;
				});&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			// Listener on resizing (override the bootstrap callout behaviour)&lt;br /&gt;
			$(window).resize(function() {&lt;br /&gt;
				setTimeout(function() {	&lt;br /&gt;
					$(&#039;input[type=text]&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
						if($(this).val() != &#039;&#039;) {&lt;br /&gt;
							var thisRow = $(this).closest(&#039;.question-item&#039;);&lt;br /&gt;
							var thisTooltip = $(&#039;.tooltip&#039;, thisRow);&lt;br /&gt;
							$(&#039;.tooltip-inner&#039;, thisTooltip).text($.trim($(this).val()));&lt;br /&gt;
							console.log($(&#039;.tooltip-inner&#039;, thisTooltip).text());&lt;br /&gt;
							thisTooltip.show().css(&#039;margin-left&#039;, &#039;-&#039;+(thisTooltip.width()/2)+&#039;px&#039;);&lt;br /&gt;
						}&lt;br /&gt;
					});&lt;br /&gt;
				}, 1);&lt;br /&gt;
			});&lt;br /&gt;
		});	&lt;br /&gt;
	};&lt;br /&gt;
})( jQuery );&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css (this is for a copy of the default template):&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/*********** Van Westendorp Pricing ***********/&lt;br /&gt;
&lt;br /&gt;
.vwp-question .control-label {&lt;br /&gt;
    margin-bottom: 35px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .withslider {&lt;br /&gt;
    margin-bottom: 0px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider-container {&lt;br /&gt;
    margin-bottom: 2.5em;&lt;br /&gt;
    margin-top: 3.5em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.vwp-question .slider.slider-horizontal .slider-handle {&lt;br /&gt;
    margin-top: -5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 600px){&lt;br /&gt;
&lt;br /&gt;
	.vwp-question .withslider {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media (max-width: 480px){&lt;br /&gt;
&lt;br /&gt;
	#outerframeContainer,&lt;br /&gt;
	.vwp-question .control-label,&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div {    &lt;br /&gt;
		padding-left: 0;&lt;br /&gt;
		padding-right: 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.vwp-question .slider-container &amp;gt; div &amp;gt; div {    &lt;br /&gt;
		padding-left: 5px;&lt;br /&gt;
		padding-right: 5px;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#To apply the plugin, add this script the multiple-numeric question source. &lt;br /&gt;
There are two options to adjust&amp;lt;br /&amp;gt; -&#039;&#039;&#039;order&#039;&#039;&#039; - this is the order that your sub-questions will be displayed (default, 1, 2, 3, 4)&amp;lt;br /&amp;gt; -&#039;&#039;&#039;randomOrder&#039;&#039;&#039; - if set to true, the &#039;&#039;&#039;order&#039;&#039;&#039; option will be overridden and the sub-question order will be randomized (default, false)&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;		&lt;br /&gt;
	$(document).ready(function(){&lt;br /&gt;
		&lt;br /&gt;
		$(&#039;#question{QID}&#039;).vWPricing25({&lt;br /&gt;
			order: [1, 2, 3, 4],&lt;br /&gt;
			randomOrder: false&lt;br /&gt;
		});&lt;br /&gt;
		&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Multiple Choice - Select &amp;quot;All of the above&amp;quot; =&lt;br /&gt;
== Version 2.67.x ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tested with: LimeSurvey version 2.67.3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This script will render the last item of a multiple-choice question as &amp;quot;Select all&amp;quot;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:All_of_the_above.zip|sample survey]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#[[Workarounds: Manipulating a survey at runtime using Javascript#How to use Script (eg. JavaScript etc.) in LimeSurvey?|Set up your survey to use JavaScript]].&lt;br /&gt;
#Create your Multiple Choice question with the last sub-questions as &amp;quot;Select all&amp;quot;.&lt;br /&gt;
#Add the following script to the source of the question text:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&lt;br /&gt;
	$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
		&lt;br /&gt;
		// Identify this question&lt;br /&gt;
		var thisQuestion = $(&#039;#question{QID}&#039;);&lt;br /&gt;
		&lt;br /&gt;
		// Initial states&lt;br /&gt;
		if($(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).is(&#039;:checked&#039;)) {&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(&#039;:last&#039;).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
		// Listener on the last checkbox&lt;br /&gt;
		$(&#039;input[type=&amp;quot;checkbox&amp;quot;]:last&#039;, thisQuestion).on(&#039;change&#039;, function(e) {&lt;br /&gt;
			if($(this).is(&#039;:checked&#039;)) {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, true).prop(&#039;disabled&#039;, true);&lt;br /&gt;
			}&lt;br /&gt;
			else {&lt;br /&gt;
				$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).prop(&#039;checked&#039;, false).prop(&#039;disabled&#039;, false);&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			// Fire Expression Manager&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).not(this).each(function(i) {&lt;br /&gt;
				checkconditions(this.value, this.name, this.type);&lt;br /&gt;
			});&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
		// Re-enable checkboxes so data gets stored&lt;br /&gt;
		$(&#039;#moveprevbtn, #movenextbtn, #movesubmitbtn&#039;).on(&#039;click&#039;, function(){&lt;br /&gt;
			$(&#039;input[type=&amp;quot;checkbox&amp;quot;]&#039;, thisQuestion).prop(&#039;disabled&#039;, false);&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
&amp;lt;/script&amp;gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pay Off Matrix Interface =&lt;br /&gt;
== LimeSurvey Version 2.67.x==&lt;br /&gt;
&lt;br /&gt;
This workaround converts a list-radio type question into a Pay Off Matrix interface.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Pay_off_matrix_1.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:Pay_off_matrix_2.png]]&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download&#039;&#039;&#039; a [[Media:Demo_Pay_Off_Matrix.zip|working template and survey]] (un-zip the package and install the template before the survey).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
#Create your List Radio question with with the upper and lower values for each answer separated by &amp;quot;pipe&amp;quot; characters.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_3.png]]&lt;br /&gt;
#Assign a class &amp;quot;pay-off-matrix&amp;quot; to that question.&amp;lt;br /&amp;gt;[[File:Pay_off_matrix_4.png]]&lt;br /&gt;
#Add the following to the end of template.js:&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$(document).on(&#039;ready pjax:complete&#039;,function() {&lt;br /&gt;
	// Apply the payOffMatrix plugin&lt;br /&gt;
	$(&#039;.pay-off-matrix&#039;).payOffMatrix({&lt;br /&gt;
			topText:	&#039;You receive&#039;, &lt;br /&gt;
			bottomText:	&#039;Others receive&#039; &lt;br /&gt;
	});&lt;br /&gt;
});&lt;br /&gt;
	&lt;br /&gt;
/*****&lt;br /&gt;
    A jQuery plugin to convert a list-radio question to a Pay Off Matrix&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
(function($){&lt;br /&gt;
 &lt;br /&gt;
	$.fn.payOffMatrix = function(options) {  &lt;br /&gt;
 &lt;br /&gt;
		var opts = $.extend( {&lt;br /&gt;
			topText:	&#039;&#039;, &lt;br /&gt;
			bottomText:	&#039;&#039; &lt;br /&gt;
		}, options);&lt;br /&gt;
 &lt;br /&gt;
		return this.each(function() {&lt;br /&gt;
			&lt;br /&gt;
			var thisQuestion = $(this);&lt;br /&gt;
&lt;br /&gt;
			// Insert the matrix elements&lt;br /&gt;
			$(&#039;div.answer&#039;, thisQuestion).prepend(&#039;&amp;lt;div class=&amp;quot;pom-outer-wrapper&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;pom-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label top&amp;quot;&amp;gt;&#039;+opts.topText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-items-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
													&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div class=&amp;quot;pom-row-label bottom&amp;quot;&amp;gt;&#039;+opts.bottomText+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
													&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
												&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			&lt;br /&gt;
			$(&#039;.answer-item&#039;, thisQuestion).each(function(i) {&lt;br /&gt;
				var thisValue = $(&#039;input.radio&#039;, this).attr(&#039;value&#039;);&lt;br /&gt;
				var itemTop = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[0];&lt;br /&gt;
				var itemBottom = $.trim($(&#039;.label-text&#039;, this).text()).split(&#039;|&#039;)[1];&lt;br /&gt;
				$(&#039;.pom-items-wrapper&#039;, thisQuestion).append(&#039;&amp;lt;div class=&amp;quot;pom-item&amp;quot;&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper top&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemTop+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-button-wrapper&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-button&amp;quot; data-value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;pom-item-label-wrapper bottom&amp;quot;&amp;gt;\&lt;br /&gt;
																	&amp;lt;div class=&amp;quot;pom-item-label&amp;quot;&amp;gt;&#039;+itemBottom+&#039;&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;/div&amp;gt;\&lt;br /&gt;
																&amp;lt;div class=&amp;quot;under-480&amp;quot; style=&amp;quot;clear:both;&amp;quot; /&amp;gt;\&lt;br /&gt;
															&amp;lt;/div&amp;gt;&#039;);&lt;br /&gt;
			});&lt;br /&gt;
			$(&#039;.pom-item:first&#039;, thisQuestion).addClass(&#039;first&#039;);&lt;br /&gt;
			$(&#039;.pom-item:last&#039;, thisQuestion).addClass(&#039;last&#039;);&lt;br /&gt;
			&lt;br /&gt;
			// Listeners on the matrix events&lt;br /&gt;
			$(&#039;.pom-item-button, .pom-item-label&#039;, thisQuestion).on(&#039;click&#039;, function(e) {&lt;br /&gt;
				$(&#039;.pom-item&#039;, thisQuestion).removeClass(&#039;active-item&#039;);&lt;br /&gt;
				$(this).closest(&#039;.pom-item&#039;).addClass(&#039;active-item&#039;);&lt;br /&gt;
				var thisValue = $(this).closest(&#039;.pom-item&#039;).find(&#039;.pom-item-button&#039;).attr(&#039;data-value&#039;);&lt;br /&gt;
				$(&#039;input.radio[value=&amp;quot;&#039;+thisValue+&#039;&amp;quot;]&#039;, thisQuestion).trigger(&#039;click&#039;);&lt;br /&gt;
			}).hover(&lt;br /&gt;
				function() {&lt;br /&gt;
					$(this).closest(&#039;.pom-item&#039;).addClass(&#039;hover&#039;);&lt;br /&gt;
				}, function() {&lt;br /&gt;
					$( this ).closest(&#039;.pom-item&#039;).removeClass(&#039;hover&#039;);&lt;br /&gt;
				}&lt;br /&gt;
			);&lt;br /&gt;
		});&lt;br /&gt;
 &lt;br /&gt;
	};&lt;br /&gt;
})(jQuery);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#Add the following to the end of template.css:&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;/***** &lt;br /&gt;
    Styles for the payOffMatrix plugin&lt;br /&gt;
    Copyright (C) 2017 - Tony Partner (http://partnersurveys.com)&lt;br /&gt;
    Licensed MIT, GPL&lt;br /&gt;
    Version - 1.0&lt;br /&gt;
    Create date - 25/09/2017&lt;br /&gt;
*****/&lt;br /&gt;
&lt;br /&gt;
.pay-off-matrix .answers-list {&lt;br /&gt;
	position: absolute;&lt;br /&gt;
	left: -9999em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-wrapper {&lt;br /&gt;
	position: relative;&lt;br /&gt;
	margin: 0 auto;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	max-width: 648px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	float: left;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label {&lt;br /&gt;
	clear: both;&lt;br /&gt;
	text-align: center;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.top {&lt;br /&gt;
	padding-top: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-row-label.bottom {&lt;br /&gt;
	padding-bottom: 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper {&lt;br /&gt;
	padding: 5px 8px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.top {&lt;br /&gt;
	margin-bottom: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label-wrapper.bottom {&lt;br /&gt;
	margin-top: 3px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item {&lt;br /&gt;
	width: 11.11111111111111%;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-label {&lt;br /&gt;
	border: 1px solid #233140;&lt;br /&gt;
	background: #EBEBEB;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	text-align:center;&lt;br /&gt;
	-moz-border-radius: 5px;&lt;br /&gt;
	-webkit-border-radius: 5px;&lt;br /&gt;
	-khtml-border-radius: 5px;&lt;br /&gt;
	border-radius: 5px;&lt;br /&gt;
	font-size: 16px;&lt;br /&gt;
	line-height: 30px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-label,&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	font-weight: bold;&lt;br /&gt;
	cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-label {&lt;br /&gt;
	background: #233140;&lt;br /&gt;
	color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button-wrapper {&lt;br /&gt;
	padding: 5px 15.27777777777778%;&lt;br /&gt;
    background: #CCD5DD;&lt;br /&gt;
	width: 69.44444444444444%;&lt;br /&gt;
	width: auto; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-webkit-border-radius: 5px 0 0 5px;&lt;br /&gt;
	-khtml-border-radius: 5px 0 0 5px;&lt;br /&gt;
	border-radius: 5px 0 0 5px;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
	-moz-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-webkit-border-radius: 0 5px 5px 0;&lt;br /&gt;
	-khtml-border-radius: 0 5px 5px 0;&lt;br /&gt;
	border-radius: 0 5px 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item-button {&lt;br /&gt;
    height: 0;&lt;br /&gt;
    width: 100%;&lt;br /&gt;
	padding-top: 100%;&lt;br /&gt;
    background: #FFFFFF;&lt;br /&gt;
	-moz-transition: background-color 300ms ease; &lt;br /&gt;
	-o-transition: background-color 300ms ease; &lt;br /&gt;
	-webkit-transition: background-color 300ms ease; &lt;br /&gt;
	transition: background-color 300ms ease;&lt;br /&gt;
	-moz-border-radius: 50%;&lt;br /&gt;
	-webkit-border-radius: 50%;&lt;br /&gt;
	-khtml-border-radius: 50%;&lt;br /&gt;
	border-radius: 50%;&lt;br /&gt;
    cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.hover .pom-item-button {&lt;br /&gt;
    background-color: #5b7fa5;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.pom-item.active-item .pom-item-button,&lt;br /&gt;
.pom-item.active-item .pom-item-button:hover {&lt;br /&gt;
	background-color: #233140;&lt;br /&gt;
	cursor:default;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media only screen and (max-width: 480px) {&lt;br /&gt;
	.pom-outer-wrapper {&lt;br /&gt;
		margin: 0 auto;&lt;br /&gt;
		padding-top: 50px;&lt;br /&gt;
		width: 256px; &lt;br /&gt;
	}&lt;br /&gt;
	.pom-wrapper {&lt;br /&gt;
		display:block;&lt;br /&gt;
		position: relative;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label {&lt;br /&gt;
		bottom: 100%;&lt;br /&gt;
		left: 0;&lt;br /&gt;
		margin-left: -25px;&lt;br /&gt;
		position: absolute;&lt;br /&gt;
		text-align: center;&lt;br /&gt;
		width: 150px;&lt;br /&gt;
		background-color: transparent !important;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-row-label.bottom {&lt;br /&gt;
		left: auto;&lt;br /&gt;
		right: 0;&lt;br /&gt;
		margin-right: -25px;&lt;br /&gt;
		padding: 5px 0 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	pom-items-wrapper {&lt;br /&gt;
		vertical-align: middle;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item {&lt;br /&gt;
		float: none;&lt;br /&gt;
		width: auto;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 !important;&lt;br /&gt;
		padding: 7px 24px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-label {&lt;br /&gt;
		width: 50px; &lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item-button-wrapper {&lt;br /&gt;
		float: left;&lt;br /&gt;
		margin: 0 5px;&lt;br /&gt;
		padding: 5px;&lt;br /&gt;
		width: 46px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.first .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-webkit-border-radius: 5px 5px 0 0;&lt;br /&gt;
		-khtml-border-radius: 5px 5px 0 0;&lt;br /&gt;
		border-radius: 5px 5px 0 0;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item.last .pom-item-button-wrapper {&lt;br /&gt;
		-moz-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-webkit-border-radius: 0 0 5px 5px;&lt;br /&gt;
		-khtml-border-radius: 0 0 5px 5px;&lt;br /&gt;
		border-radius: 0 0 5px 5px;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	.pom-item .under-480 {&lt;br /&gt;
		display: block !important;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tpartner</name></author>
	</entry>
</feed>